E
Emanuele D'Arrigo
Greetings,
today I did something like this:
class MyClass(object):
@classmethod
def myClassMethod(self):
print "ham"
myProperty = property(myClassMethod, None, None)
As many of you know this doesn't work and returns a TypeError: the
object passed to the property is not a callable function but a
classmethod object, which isn't callable at all. So, how do I do this?
Ultimately all I want is a non-callable class-level attribute
MyClass.myProperty that gives the result of MyClass.myClassMethod().
Can it be done?
Manu
today I did something like this:
class MyClass(object):
@classmethod
def myClassMethod(self):
print "ham"
myProperty = property(myClassMethod, None, None)
As many of you know this doesn't work and returns a TypeError: the
object passed to the property is not a callable function but a
classmethod object, which isn't callable at all. So, how do I do this?
Ultimately all I want is a non-callable class-level attribute
MyClass.myProperty that gives the result of MyClass.myClassMethod().
Can it be done?
Manu