Simple list.append() question

Bill Wilkinson bwilk_97 at yahoo.com
Wed Apr 26 10:52:50 CEST 2000


oh. I see.

Even though it is making a copy of the original list. It is a reference to
the same copy three times.

Thanks

:)


"Fredrik Lundh" <effbot at telia.com> wrote in message
news:vM5N4.1522$wYl.188802560 at newsb.telia.net...
| Bill Wilkinson <bwilk_97 at yahoo.com> wrote:
| > l = [[][:]] * 3
|
| same problem as the original code:
|
| >>> l = [[][:]] * 3
| >>> l
| [[], [], []]
| >>> l[0].append(1)
| >>> l
| [[1], [1], [1]]
|
| </F>
|
|





More information about the Python-list mailing list