Jiri Barton wrote:
> Hi everyone,
>
> I have a problem with initialization.
>
>>>>a, b = [[]]*2
>>>>a.append(1)
>>>>b
> [1]
>
> Why is this? Why does not this behave like the below:
>
>>> a, b = [[]]*2
>>> a==b
True
>
> And, just to add to my confusion:
>
>
>>>>[[]]*2
>
> [[], []]
>
>>>>[[], []] == [[]]*2
>
> True
This confuses me also,looks like empty lists share same object.
Paolino
___________________________________
Yahoo! Mail: gratis 1GB per i messaggi e allegati da 10MB
http://mail.yahoo.it
--
http://mail.python.org/mailman/listinfo/python-list