1
class test:
    @staticmethod
    def somefunc():
        pass

a = test.somefunc

if I print a, it gives

<function __main__.somefunc>

where I can not tell which class it belongs to?

Warren
  • 991
  • 11
  • 28
  • 3
    Upgrade to Python 3, where function objects have a `__qualname__` attribute that includes the class name if defined in a class statement. – Martijn Pieters Sep 30 '16 at 12:30
  • @gnebehay Thanks for pointing out, I get the same error as mentioned in the comment of the answer in the other thread: 'function' object has no attribute 'im_class' – Warren Sep 30 '16 at 12:40

0 Answers0