36 def copy(self, **attributes):
37 copied = copy.copy(self)
38 for name
in attributes:
39 setattr(copied, name, attributes[name])
54 copied = copy.deepcopy(self)
55 for name
in attributes:
56 setattr(copied, name, attributes[name])
63 return repr(str(self))
73 dictstate, slotstate = state
74 if dictstate
is not None:
75 self.__dict__.update(dictstate)
76 for name
in slotstate:
83 setter_name =
'_setter__' + name
84 if setter_name
not in slotstate:
85 setattr(self, name, slotstate[name])
def __setstate__(self, state)
Customize attribute updating when using the copy module.
def deepcopy(self, **attributes)
Return deep copy of this object.
def copy(self, **attributes)
Return shallow copy of this object.
def with_metaclass(meta, *bases)
Create a base class with a metaclass.