general class functions
Andrea Griffini
agriff at tin.it
Wed Nov 3 01:36:55 EST 2004
On Tue, 02 Nov 2004 13:31:42 -0500, Kent Johnson <kent3737 at yahoo.com>
wrote:
>Instead of
> return self.__dict__[name]
>you need
> raise AttributeError, name
>
>self.__dict__ has already been tried before __getattr__ is called, you
>don't need to try it again.
I hope one day I'll understand python lookup :-)
...
Would it be worse or better to make Library a new-style
class, using __getattribute__ instead of __getattr__ and
defaulting to object.__getattribute__(self,name) in the
"else" part ?
Andrea
More information about the Python-list
mailing list