나는이 파이썬 문서 페이지를 찾고 : 오른쪽 아래파이썬 연산자가 속성 데코레이터로 오버로드 되었습니까?
http://docs.python.org/2/library/functions.html#property
class C(object):
def __init__(self):
self._x = None
def getx(self):
return self._x
def setx(self, value):
self._x = value
def delx(self):
del self._x
x = property(getx, setx, delx, "I'm the 'x' property.")
은 말한다 :
나에게If then c is an instance of C, c.x will invoke the getter, c.x = value will invoke the setter and del c.x the deleter.
, CX는 = 값이 함수 값의 할당과 같은 왜냐하면 "="연산자가 오버로드되지 않는 한 cx가 함수이기 때문입니다. 여기서 일어나는 일이 무엇입니까?
del c.x와 동일한 항목
감사합니다.
'c.x'는 기능이 아닙니다, 그것은 속성 객체입니다. – BrenBarn