P
Paul Melis
Hello,
The python library docs read in section 2.1
(http://docs.python.org/lib/built-in-funcs.html):
"
....
property( [fget[, fset[, fdel[, doc]]]])
Return a property attribute for new-style classes (classes that
derive from object).
....
"
But in 2.4 at least properties also seem to work for old-style classes:
class O:
def __init__(self):
self._x = 15
def get_x(self):
return self._x
x = property(get_x)
o = O()
print o.x
outputs "15" as expected for the property.
Regards,
Paul
The python library docs read in section 2.1
(http://docs.python.org/lib/built-in-funcs.html):
"
....
property( [fget[, fset[, fdel[, doc]]]])
Return a property attribute for new-style classes (classes that
derive from object).
....
"
But in 2.4 at least properties also seem to work for old-style classes:
class O:
def __init__(self):
self._x = 15
def get_x(self):
return self._x
x = property(get_x)
o = O()
print o.x
outputs "15" as expected for the property.
Regards,
Paul