Given a nested class B:
class A:
class B:
def __init__(self):
pass
ab = A.B()
How can I get the full name of the class for ab? I'd expect a result like A.B.
Given a nested class B:
class A:
class B:
def __init__(self):
pass
ab = A.B()
How can I get the full name of the class for ab? I'd expect a result like A.B.
You could get the fully qualified name, __qualname__, of its __class__:
>>> ab.__class__.__qualname__
'A.B'
Preferably by using type (which calls __class__ on the instance):
>>> type(ab).__qualname__