__getattr__ and __setattr__ troubles

François Pinard pinard at iro.umontreal.ca
Tue Jun 6 15:39:45 EDT 2000


François Pinard <pinard at iro.umontreal.ca> writes:

> * May I least get the default string representation, which was satisfying?

> * So, as soon as I use `__getattr__', I suddenly get a lot of other things to
>   define as well?  This would make `__getattr__' less attractive.

Let me reply to my own message for these last two points (points 3. and
4., points 1. and 2. still remain, but are "lightier").  The two problems
above are solved by merely inserting a:

    raise AttributeError

whenever the `__getattr__' function does not know how to handle the thing.
Simple and clean to me.  Sorry for my noise.

-- 
François Pinard   http://www.iro.umontreal.ca/~pinard






More information about the Python-list mailing list