[ python-Bugs-1388804 ] Polymorphic getters / setters
SourceForge.net
noreply at sourceforge.net
Fri Dec 23 12:26:54 CET 2005
Bugs item #1388804, was opened at 2005-12-23 12:26
Message generated for change (Tracker Item Submitted) made by Item Submitter
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: Open
Resolution: None
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
----------------------------------------------------------------------
You can respond by visiting:
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1388804&group_id=5470
More information about the Python-bugs-list
mailing list