Bug or Feature?

Fuming Wang fmwang at mediaone.net
Fri Apr 23 11:14:49 EDT 1999


Hi,

I found this little surprise with Python 1.5.1:


>list = [[0]*2]*4
>list
[[0, 0], [0, 0], [0, 0], [0, 0]]
>list[0][1] = 9
>list
[[0, 9], [0, 9], [0, 9], [0, 9]]

Is this a bug or a feature that I don't know about?

Fuming




More information about the Python-list mailing list