2.2 properties and subclasses
Miles Egan
miles at rddac.com
Mon May 19 17:20:43 EDT 2003
This prints "BASE" instead of "SUB". Is this right?
class BaseClass(object):
def __init__(self):
self._prop = "BASE"
def get_prop(self): return self._prop
prop = property(get_prop)
class SubClass(BaseClass):
def get_prop(self): return "SUB"
b = BaseClass()
print b.prop
s = SubClass()
print s.prop
--
miles egan
miles at rddac.com
reverse the domain name to find me
OpenPGP/GPG Key 0x01F53D51 @ wwwkeys.us.pgp.net
More information about the Python-list
mailing list