How can I get the class name, including the full path from its module root? For Python 3.3 and above?
Here is a sample Python code:
class A: class B: class C: def me(self): print(self.__module__) print(type(self).__name__) print(repr(self)) x = ABC() x.me()
This code takes me to Python 3.3:
__main__ C <__main__.ABC object at 0x0000000002A47278>
So, Python internally knows that my __main__.ABC object, but how can I get this programmatically? I can parse repr(self) , but it sounds like cracking me.
source share