29 Aug 02:22
Re: exactly same as [1,2,3,] ?
From: Patrick Maupin <pmaupin <at> gmail.com>
Subject: Re: exactly same as [1,2,3,] ?
Newsgroups: gmane.comp.python.general
Date: 2008-08-29 00:22:27 GMT
Subject: Re: exactly same as [1,2,3,] ?
Newsgroups: gmane.comp.python.general
Date: 2008-08-29 00:22:27 GMT
On Aug 28, 6:35 pm, "James Mills" <prolo...@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
--
http://mail.python.org/mailman/listinfo/python-list
(Continue reading)
RSS Feed