deepcopy chokes with TypeError on dynamically assigned instance method

Kanenas kanenas at tcomcastd.tnet
Thu Feb 10 19:52:18 EST 2005


On Thu, 10 Feb 2005 23:50:09 +1000, Nick Coghlan
<ncoghlan at iinet.net.au> wrote:

>>     def __init__(self, l=[]):
>
>Change this too:
>   def __init__(self, l=None):
>     if l is None: l = []

Same error.  The only ways of not getting the TypeError I've found are
not to call deepcopy or not assign an instancemethod to an instance
attribute (assigning an instancemethod to a class attribute is fine).



More information about the Python-list mailing list