To define a property, we can use
class MyClass(object):
def __init__(f):
self._f = f
def custom_function(self):
self._f += 1
@property
def f(self):
return self._f
such that
>>x = MyClass(1)
>>print(x.f) # prints 2
Is there any standard way to define the interface
>>MyClass.f # <- calls custom classmethod
? I.e. a "@classproperty
".
I'm aware of @classmethod
but I don't want the interface to have the call ()
.