Add a note about the dependency between relative imports and the value in '__name__'
This commit is contained in:
parent
f36e51cc18
commit
073d9b3d10
|
@ -267,6 +267,15 @@ is usable in an expression. But ::
|
|||
is not usable in an expression.
|
||||
|
||||
|
||||
Relative Imports and __name__
|
||||
===============================
|
||||
|
||||
Relative imports use a module's __name__ attribute to determine that
|
||||
module's position in the package hierarchy. If the module's name does
|
||||
not contain any package information (e.g. it is set to '__main__')
|
||||
then relative imports are resolved as if the module were a top level
|
||||
module, regardless of where the module is actually located on the file
|
||||
system.
|
||||
|
||||
|
||||
References
|
||||
|
|
Loading…
Reference in New Issue