Really virtual properties

Torsten Bronger bronger at physik.rwth-aachen.de
Thu Aug 18 17:36:58 EDT 2005


Hallöchen!

When I use properties in new style classes, I usually pass get/set
methods to property(), like this:

    x = property(get_x)

If I overwrite get_x in a derived class, any access to x still calls
the base get_x() method.  Is there a way to get the child's get_x()
method called instead?

(I found the possibility of using an intermediate method _get_x
which calls get_x but that's ugly.)

Tschö,
Torsten.

-- 
Torsten Bronger, aquisgrana, europa vetus



More information about the Python-list mailing list