This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author trialcode
Recipients
Date 2005-12-23.13:08:36
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
If you add a property to a class with a getter and/or
setter and override the getter and/or setter in a
subclass the baseclass implementation of the methods is
still called when the property is accessed on objects
of the subclass (see below for example).
This feels like a pretty arbitrary limitation that
prevents overriding the behaviour of properties like
you would with a normal method. I'm sure there's a way
to make the property search the inheritance-hierarchy
for the provided method signature when called.

class base(object):
def get_foo(self):
print "Base get"
def set_foo(self, value):
print "Base set"
foo = property(get_foo, set_foo)

class sub(base):
def get_foo(self):
print "Sub get"
def set_foo(self, value):
print "Sub set"

s = sub()
s.foo = s.foo

-- Prints:

Base get
Base set
History
Date User Action Args
2008-01-20 09:59:43adminlinkissue1388872 messages
2008-01-20 09:59:43admincreate