3
In Python functions/methods and classes have two attributes that in their most "basic" use seem to do exactly the same thing, are they: __name__
and __qualname__
, see:
def fn():
pass
class C(object):
pass
>>> fn.__name__
"fn"
>>> fn.__qualname__
"fn"
>>> C.__name__
"C"
>>> C.__qualname__
"C"
What’s the difference between __name__
and __qualname__
?
Useful: https://www.python.org/dev/peps/pep-3155/
– bfavaretto