I want to find out all classmethods of class Something
below by using code reflection. With all classmethods i mean all methods which are decorated with @classmethod
. I don't actually know if that is the same.
class Something:
@classmethod
def a(cls):
print('a')
@staticmethod
def b(cls):
print('b')
def c(self):
print('c')
So in this case I expect getting a list which contains only 'a'
:
get_classmethod_names(Something) == ['a']
Aucun commentaire:
Enregistrer un commentaire