How to get/set class attributes in Python
Axel Straschil
axel at straschil.com
Mon Jun 13 00:12:54 EDT 2005
Hello!
> You can 'hide' you getsetters using a property attribute[1]:
For me, the property attribute is a beast:
class A(object):
def getP(self): return 'A'
p = property(getP)
class A2(A):
def getP(self): return 'A2'
a = A()
a2 = A2()
print a.getP(), a2.getP()
print a.p, a2.p
So, property is instance-level super() tool ;-)
Lg,
AXEL.
--
Gentoo? Debian? RedHat? SuSE? *BSD? Stop the distri-war, make little user!
More information about the Python-list
mailing list