Hello,
Here is my problem :
class myClass:
def addmethod(name, method):
maClasse.__dict __[name] = method
addmethod = staticmethod(ad dmethod)
def hello():
print "hello"
myClasse.addmet hod('hello',hel lo)
Traceback (most recent call last):
File "<pyshell#0 >", line 1, in -toplevel-
myClass.hello()
TypeError: unbound method hello() must be called with myClass instance
as first argument (got nothing instead)
I would like to make this call:
myClass.hello()
Is there a way of making 'hello' a
static method of 'myClass ?
Regards
Here is my problem :
class myClass:
def addmethod(name, method):
maClasse.__dict __[name] = method
addmethod = staticmethod(ad dmethod)
def hello():
print "hello"
myClasse.addmet hod('hello',hel lo)
Traceback (most recent call last):
File "<pyshell#0 >", line 1, in -toplevel-
myClass.hello()
TypeError: unbound method hello() must be called with myClass instance
as first argument (got nothing instead)
I would like to make this call:
myClass.hello()
Is there a way of making 'hello' a
static method of 'myClass ?
Regards
Comment