def inner(cls):def call(func):
return func(**{k:v for k,v in cls.__dict__.items() if not
k.startswith('_')})
return inner
class Foo:
def __init__(self):
self._x = 42
@call(property)
class x:
def fget(self):
return self._x
def fset(self, value):
self._x = value
def fdel(self):
del self._x
make_property = call(property)
class Foo:
def __init__(self):
self._x = 42
@make_property
class x:
def fget(self):
return self._x
def fset(self, value):
self._x = value
def fdel(self):
del self._x