cPickle problem

Alex Martelli aleax at aleax.it
Tue Apr 30 17:30:08 EDT 2002


Vojin Jovanovic wrote:
        ...
> can I replace addequation with __setattr__ so that I can type
> 
>>>>k.c='self.a+self.b'
> 
> to achieve the same effect.

Yes.

> My attempts with __setattr__ were unsuccessful.

Probably because you kept using instructions such as self.y=4 in
other methods.  When you add __setattr__ you must also
translate such instructions into self.__dict__['y']=4 and the like.


Alex




More information about the Python-list mailing list