Really virtual properties

Diez B. Roggisch deets at web.de
Thu Aug 18 17:44:44 EDT 2005


I don't think so - the reason is that property(<getter>) is evaluated
in the baseclass, and stores a callable, not a name. the only thing you
could do is either

 - create a level of indirection, using lambda, to force the lookup:

 x = property(lamda self: self.get_x())

 - use a metaclass, that tries to scan the baseclass for properties
that uise functionnames which are redefined in the current class, and
recrerate a new property for those. 

Diez




More information about the Python-list mailing list