Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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.

like image 702
Niels Bom Avatar asked Jun 16 '26 08:06

Niels Bom


1 Answers

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.

like image 57
Martijn Pieters Avatar answered Jun 17 '26 20:06

Martijn Pieters



Donate For Us

If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!