properties and inheritance

Neal D. Becker ndbecker2 at
Thu Oct 7 07:34:32 EDT 2004

It seems that properties, as implemented in 2.3, don't behave as I'd expect
with respect to inheritance:

class A (object):
    def f(self):
        print "A"

    doF = property (fget=f)

class B(A):
    def f(self):
        print "B"

b = B()
b.doF : prints "A"

Is there a rationale for this?  I would have thought that if properties are
a shorthand for calling functions, and functions are polymorphic, then why
are properties not?  Doesn't that make properties behaviour inconsistent
with other attributes?

More information about the Python-list mailing list