Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Using pickle with setattr

Thread Tools

Using pickle with setattr

Posts: n/a
For the project I'm working on right now I'm dealing with a lot of class
objects that I plan to be changing at run-time through the
get/has/setattr functions. I'm wondering whether or not the standard
Pickle module will handle this or not -- will an object pickle correctly
if it has methods that are not in its original class definition? The
wiki tells me it doesn't work correctly if you save an object of a
class, then change that class and load the object. That I'm not planning
to do -- I'm changing the attributes of the object itself.

If it won't, what are my options? Also, is there a module available for
saving the complete state of an object such that it is loadable without
the python source for the original class?

Reply With Quote

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
pickle error: can't pickle instancemethod objects Michele Simionato Python 2 05-23-2008 08:29 AM
recursion error using setattr and getattr Nathan Harmston Python 0 06-07-2007 11:23 AM
a pickle's pickle Python 4 08-02-2005 07:20 PM
Re: Using pickle with setattr dataangel Python 3 10-15-2004 01:48 AM
setattr using invalid attribute names - bug or feature? Gerson Kurz Python 4 06-14-2004 07:55 PM