K
K Richard Pixley
Could someone please explain to me why the two values at the bottom of
this example are different?
Python-3.3 if it makes any difference.
Is this a difference in evaluation between a class attribute and an
instance attribute?
--rich
class C:
def __init__(self):
self._x = None
def getx(self):
print('getx')
return self._x
def setx(self, value):
print('setx')
self._x = value
def delx(self):
print('delx')
del self._x
x = property(getx, setx, delx, "I'm the 'x' property.")
class D:
def getx(self):
print('getx')
return self._x
def setx(self, value):
print('setx')
self._x = value
def delx(self):
print('delx')
del self._x
def __init__(self):
self._x = None
self.x = property(self.getx, self.setx, self.delx, "I'm the 'x'
property.")
type(C().x)
type(D().x)
this example are different?
Python-3.3 if it makes any difference.
Is this a difference in evaluation between a class attribute and an
instance attribute?
--rich
class C:
def __init__(self):
self._x = None
def getx(self):
print('getx')
return self._x
def setx(self, value):
print('setx')
self._x = value
def delx(self):
print('delx')
del self._x
x = property(getx, setx, delx, "I'm the 'x' property.")
class D:
def getx(self):
print('getx')
return self._x
def setx(self, value):
print('setx')
self._x = value
def delx(self):
print('delx')
del self._x
def __init__(self):
self._x = None
self.x = property(self.getx, self.setx, self.delx, "I'm the 'x'
property.")
type(C().x)
type(D().x)