mit getattr() scheind es nicht zu gehen:
Code: Alles auswählen
class test_class:
def test( self ):
return "foo"
print getattr( test_class, "test" )
Ich will aber "foo" zurück<unbound method test_class.test>
Code: Alles auswählen
class test_class:
def test( self ):
return "foo"
print getattr( test_class, "test" )
Ich will aber "foo" zurück<unbound method test_class.test>
Code: Alles auswählen
print getattr( test_class(), "test" )