Object copying itself
Dale Strickland-Clark
dale at riverhall.NOTHANKS.co.uk
Fri Feb 15 14:07:35 EST 2002
It occurs to me that I could use copy.copy to do most of the work and
patch up the bits it missed afterwards
What's the best approach?
class data:
def __init__(self, defaults=None):
if defaults:
self.__dict__ = copy.copy(defaults.__dict__)
Is that safe?
or what about:
self = copy.copy(defaults)
Any other ideas?
Cheers.
--
Dale Strickland-Clark
Riverhall Systems Ltd
More information about the Python-list
mailing list