Re: Pickling a class with a __getattr__

2007-04-01 Thread Peter Bengtsson
On Apr 1, 5:48 pm, Peter Otten <[EMAIL PROTECTED]> wrote: > Peter Bengtsson wrote: > > Hi, I'm trying to pickle an object instance of a class that is like a > > dict but with a __getattr__ and I'm getting pickling errors. > > This is what happens when I'm trying to be clever: > > import cPickl

Re: Pickling a class with a __getattr__

2007-04-01 Thread Peter Otten
Peter Bengtsson wrote: > Hi, I'm trying to pickle an object instance of a class that is like a > dict but with a __getattr__ and I'm getting pickling errors. > This is what happens when I'm trying to be clever: > import cPickle as pickle class Dict(dict): > ... def __getattr__(self

Pickling a class with a __getattr__

2007-04-01 Thread Peter Bengtsson
Hi, I'm trying to pickle an object instance of a class that is like a dict but with a __getattr__ and I'm getting pickling errors. This works but is not good enough. $ python2.4 >>> import cPickle as pickle >>> class Dict(dict): ... pass ... >>> >>> >>> friend = Dict(name='Zahid', age=40) >>>