exactly same as [1,2,3,] ?
Patrick Maupin
pmaupin at gmail.com
Thu Aug 28 20:22:27 EDT 2008
- Previous message (by thread): [1,2,3] exactly same as [1,2,3,] ?
- Next message (by thread): [1,2,3] exactly same as [1,2,3,] ?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
On Aug 28, 6:35 pm, "James Mills" <prolo... at shortcircuit.net.au>
wrote:
> I must point out though that although they contain
> the same elements/data, they are not the same
> object/instance.
>
> {{{
> #!python
>
> >>> x = [1, 2, 3]
> >>> y = [1, 2, 3]
> >>> id(x)
> 3083095148L
> >>> id(y)
> 3082953324L
> >>> x == y
> True
> }}}
Umm, yeah, but that's true of ANY two mutable objects you create, and
has absolutely nothing to do with whether the syntax which generated
the list contains a trailing comma or not. To wit:
>>> [1,2,3] is [1,2,3]
False
Regards,
Pat
- Previous message (by thread): [1,2,3] exactly same as [1,2,3,] ?
- Next message (by thread): [1,2,3] exactly same as [1,2,3,] ?
- Messages sorted by:
[ date ]
[ thread ]
[ subject ]
[ author ]
More information about the Python-list
mailing list