Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > deepcopy in new-style classes

Reply
Thread Tools

deepcopy in new-style classes

 
 
Donnal Walter
Guest
Posts: n/a
 
      06-22-2004
I have defined a set of new-style classes that override __getstate__()
and __setstate__(). For these classes, copy.deepcopy works fine as long
as __getstate__() returns a value other than None, False, [], {}, '' and
0. The 2.3 documentation says: """For new-style classes, if
__getstate__() returns a false value, the __setstate__() method will not
be called. """ Why is this the case? And is there someway to get around
this, i.e. force __setstate__() to be called anyway?

Donnal Walter
Arkansas Children's Hospital



 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
deepcopy chokes with TypeError on dynamically assigned instance method 5HH575-UAZWKVVP-7H2H48V3 Python 7 02-15-2005 08:17 AM
deepcopy and file object attributes Dan Perl Python 0 09-14-2004 07:47 PM
deepcopy raises TypeError for method/function? OKB (not okblacke) Python 3 09-10-2004 06:17 AM
Legitimacy of deepcopy Eugeni Doljenko Python 2 06-07-2004 09:38 PM
Deepcopy on XML node in python2.2 problem sag@hydrosphere.com Python 0 09-08-2003 07:38 PM



Advertisments