Add a note about the dependency between relative imports and the value in '__name__'

This commit is contained in:
Nick Coghlan 2006-06-27 12:27:50 +00:00
parent f36e51cc18
commit 073d9b3d10
1 changed files with 9 additions and 0 deletions

View File

@ -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