python - How to get the class name of a staticmethod -
python - How to get the class name of a staticmethod -
so there static method in base of operations class, , sub classes should utilize it.
however, need know sub class calls static method.
the code this:
class baseclass(): @staticmethod def getname(): #some magic class subclassa(baseclass): pass class subclassb(baseclass): pass subclassa.getname() #hope see 'subclassa' subclassb.getname() #hope see 'subclassb'
or, possible?
not possible staticmethod
. possible, however, classmethod
class a(object): @classmethod def f(cls): print cls
python static-methods
Comments
Post a Comment