__getattr__ and recursion ?

Stef Mientki stef.mientki at gmail.com
Thu May 1 06:10:45 EDT 2008


thanks Peter,

for your perfect explanation, and
> By the way, looping over a dictionary destroys its key advantage, O(1)
> lookup. Use
>
> # untested
> if attr in self.extra_setters:
>     self.extra_setters[attr](value)
> else:
>     self.__dict__[attr] = value
>
> and something similar in __getattr__().
>
>   
yes, that's probably much better, have to get used to this Python behavior,
thanks,

cheers,
Stef




More information about the Python-list mailing list