Python Macros

Just just at xs4all.nl
Wed Oct 6 18:18:30 EDT 2004


In article <1gl8ciq.sqxbf1q3i6f3N%aleaxit at yahoo.com>,
 aleaxit at yahoo.com (Alex Martelli) wrote:

> G. S. Hayes <sjdevnull at yahoo.com> wrote:
>    ...
> >     def __getattr__(self, attr):
> >         if not hasattr(self, attr):
> 
> redundant: hasattr(self, attr) will ALWAYS be false here, or else
> __getattr__ wouldn't have been entered in the first place.

Worse, hasattr(self, attr) will invoke self.__getattr__()...

Just



More information about the Python-list mailing list