__getattr__ and __setattr__ troubles
Moshe Zadka
moshez at math.huji.ac.il
Wed Jun 7 01:52:32 EDT 2000
On 6 Jun 2000, [ISO-8859-1] François Pinard wrote:
> class See:
>
> def __getattr__(self, key):
> print '**', key
> return None
Ummm... __getattr__ should do something *based on the key*....
> * 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.
This is a good thing. It makes using __getattr__ less common, which makes
programs more readable.
--
Moshe Zadka <moshez at math.huji.ac.il>
http://www.oreilly.com/news/prescod_0300.html
http://www.linux.org.il -- we put the penguin in .com
More information about the Python-list
mailing list