On Tue, 03 Jan 2006 19:21:32 +0100, Damien Wyart wrote: > Thanks for these important and useful additions, they are very welcome ! > > In writing my answer I had immutables in mind, but mutables are a bit > more dangerous, here...
Mutables are easy to deal with using the copy module and list comprehensions: >>> foo = [] >>> import copy >>> multi_foo = [copy.copy(foo) for _ in range(10)] >>> multi_foo [[], [], [], [], [], [], [], [], [], []] >>> multi_foo[5].append(None) >>> multi_foo [[], [], [], [], [], [None], [], [], [], []] Or use copy.deepcopy if you need to. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list