descriptors and old-style classes

Adrien Di Mascio adim at logilab.fr
Tue Jan 27 12:34:07 EST 2004


Hi,

I've recently discovered that descriptors can be used with old-style
classes if they don't define a __set__ method (and this would be why
class and static methods are usable with old-style classes).
I understand why the __set__ method is not called with old-style
classes, but I don't understand why __get__ *is* called.
I thought the transformation from :
  a.x
into :
  type(a).__dict__['x'].__get__(a, type(a))
was done in object.__getattribute__ (or type.__getattribute__), but then
this does not explain why this also seems to work with old-style
classes.

Could someboby help me here ??

Cheers,
Adrien.

-- 
Adrien Di Mascio
LOGILAB, Paris (France).
http://www.logilab.com   http://www.logilab.fr   http://www.logilab.org




More information about the Python-list mailing list