Bugs item #1388804, was opened at 2005-12-23 12:26
Message generated for change (Comment added) made by birkenfeld
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1388804&group_id=5470
Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Python Interpreter Core
Group: Python 2.4
>Status: Closed
>Resolution: Invalid
Priority: 5
Submitted By: Adde (trialcode)
Assigned to: Nobody/Anonymous (nobody)
Summary: Polymorphic getters / setters
Initial Comment:
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.
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
----------------------------------------------------------------------
>Comment By: Reinhold Birkenfeld (birkenfeld)
Date: 2005-12-23 12:32
Message:
Logged In: YES
user_id=1188172
This is expected behavior. The property is created with
references to the specific methods "base.get_foo" and
"base.set_foo".
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1388804&group_id=5470
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com