__getattr__ question

Alex Martelli aleax at mac.com
Fri Jun 9 21:56:16 EDT 2006


Andrew Robert <andrew.arobert at gmail.com> wrote:

> If I remember correctly, this behavior depends on how the class is
> created (classic mode versus modern).
> 
> Modern
> 
>       class foo(object):
>               pass
> 
> Classic ( pre python 2.2 I believe )
> 
>       class foo():

No parentheses allowed here (they do become optional in 2.5).

>               pass
> 
> The modern method of specifying object in the class definition gets all
> of the class attributes cleanly.
> 
> The classic method does not have this so the behavior is simulated.

No, you can specify normal attributes in classic as well as new-style
classes.  You may rather be thinking of *property*, which doesn't
completely work for classic classes.


Alex



More information about the Python-list mailing list