On 15/08/12 04:25, Matt Gregory 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?

Only the person making the copy can answer that question, but in general, 
shallow copies are more common than deep copies.

Making a deep copy can be relatively expensive, because Python will copy all 
the way down, as many levels deep as there are. But it's the only way to ensure 
that each copy is truly independent.


I think that Steven's class method gets around this?

Only by ignoring it completely :)


--
Steven
_______________________________________________
Tutor maillist  -  [email protected]
To unsubscribe or change subscription options:
http://mail.python.org/mailman/listinfo/tutor

Reply via email to