exactly same as [1,2,3,] ?

Patrick Maupin pmaupin at gmail.com
Fri Aug 29 02:22:27 CEST 2008


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



More information about the Python-list mailing list