Q: Duplicating Objects ... HOW ???

Tomasz Lisowski lisowski.tomasz at sssa.NOSPAM.com.pl
Thu Jul 12 05:09:57 EDT 2001


U¿ytkownik "Alex" <new_name at mit.edu> napisa³ w wiadomo¶ci
news:etd7kxjcp8x.fsf at pickled-herring.mit.edu...
>
> You may be happier in the long run keeping the sequence of test objects
> in a sequence, like a list.  You could do something like this:
>
> import copy
> test_list = [copy.copy(obj) for obj in 20*[test]]
>

Sometimes deepcopy() should be used :-)
Tomasz Lisowski





More information about the Python-list mailing list