2005/5/21, Kent Johnson <[EMAIL PROTECTED]>:

> 3*[[]] makes a list with three references to the *same* list. This can cause 
> surprising behavior:
>
>   >>> l=3*[[]]
>   >>> l
> [[], [], []]
>   >>> l[0].append(1)
>   >>> l
> [[1], [1], [1]]

I see.

> Often using a dict is a good solution to this type of question.

I didn't notice a dict.

Thank you,

Mitsuo
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to