Q: Duplicating Objects ... HOW ???

Steve Holden sholden at holdenweb.com
Mon Jul 9 08:12:23 EDT 2001


"phil hunt" <philh at comuno.freeserve.co.uk> wrote in message
news:slrn9khoer.cpe.philh at comuno.freeserve.co.uk...
> On Sun, 8 Jul 2001 16:29:59 -0400, Steve Holden <sholden at holdenweb.com>
wrote:
> >"Steve Holden" <sholden at holdenweb.com> wrote in message
> >news:Uh327.14798$i8.1312190 at e420r-atl3.usenetserver.com...
> >> "Alex" <new_name at mit.edu> wrote in message
> >> 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]]
> >> >
> >> Or, possibly, in a dictionary:
> >>
> >> dict = {}
> >> for i in range(1,21):
> >>     dict[test+str(i)] = copy.copy(obj)
> >>
> >Sorry, read that last as
> >
> >    dict["test"+str(i)] = copy.copy.(obj)
>
> You're not haviong much luck with the typos, are you?
>
Typos, thinkos, I get htem all. Talk about "let yuor fngiers do the
wlaking"...

regards
 Steve

--
http://www.holdenweb.com/








More information about the Python-list mailing list