__qualname__

Dunder AttributePython 2.0+Advanced

Qualified name of a class or function (includes enclosing scope)

Quick Info

Documentation
Official Docs
Python Version
2.0+

Learn by Difficulty

Quick Example

python
# __qualname__ holds the qualified name
class Outer:
    class Inner:
        def method(self):
            pass

print(Outer.__qualname__)
print(Outer.Inner.__qualname__)
print(Outer.Inner.method.__qualname__)

__qualname__ is a special attribute that qualified name of a class or function (includes enclosing scope).

Try in Playground

Tags

oopintrospectioncore