What Is A Qualified/unqualified Name In Python?
In Python: what is a 'qualified name' or 'unqualified name'? I've seen it mentioned a couple of times, but no explanation as to what it is.
Solution 1:
It is the path from top-level module down to the object itself.
See PEP 3155, Qualified name for classes and functions.
If you have a nested package named foo.bar.baz
with a class Spam
, the method ham
on that class will have a fully qualified name of foo.bar.baz.Spam.ham
. ham
is the unqualified name.
A qualified name lets you re-import the exact same object, provided it is not an object that is private to a local (function) namespace.
Post a Comment for "What Is A Qualified/unqualified Name In Python?"