On Tue, Aug 14, 2012 at 2:25 PM, Matt Gregory
<matt.greg...@oregonstate.edu> wrote:
>
> Thanks to you both for really helpful advice.  A quick follow-up question -
> would you want to create a deepcopy of obj1 in the above example if your
> obj1 contained other objects?  I think that Steven's class method gets
> around this?

Chances are you either want a shallow copy or to use a special
constructor as Steven wrote.  For example, consider an object with a
file attribute based on a filename argument. Say for example it's for
an MP3 file and the object reads in the ID3 tags in __init__. If you
want a new instance based on the same arguments, except for a
different MP3 file, then you don't want a copy or a deepcopy.
_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to