J
Joe P. Cool
Hi,
I like C#'s style of defining a property in one place. Can the
following way
to create a property be considered reasonable Python style (without
the
print statements, of course)?
class sample(object):
def __init__(self):
sample.y = self._property_y()
def _property_y(self):
def _get(self):
print 'getting y.'
return self._y
def _set(self, value):
print 'setting y.'
self._y = value
def _del(self):
print 'bye, y!'
del self._y
return property(_get, _set, _del)
I like C#'s style of defining a property in one place. Can the
following way
to create a property be considered reasonable Python style (without
the
print statements, of course)?
class sample(object):
def __init__(self):
sample.y = self._property_y()
def _property_y(self):
def _get(self):
print 'getting y.'
return self._y
def _set(self, value):
print 'setting y.'
self._y = value
def _del(self):
print 'bye, y!'
del self._y
return property(_get, _set, _del)