I used python 2.5, I want to know how can change the next code when the Platform is python2.5 or python2.6
class C(object):
def __init__(self):
self._x = None
@property
def x(self):
"""I'm the 'x' property."""
return self._x
@x.setter
def x(self, value):
self._x = value
@x.deleter
def x(self):
del self._x
a=C()
print a.x#error
thanks
thanks ,alex,i think property must be 3 arguments in your example
but ,i have seen a code which with 'property' only use 1 argumennt ,why,can it work
class SortingMiddleware(object):
def process_request(self, request):
request.__class__.field = property(get_field)
request.__class__.direction = property(get_direction)