Add explicit note regarding __package__ in top level modules

This commit is contained in:
Nick Coghlan 2009-02-01 13:01:16 +00:00
parent 47b1d922f9
commit 0f022e6d1d
1 changed files with 6 additions and 0 deletions

View File

@ -72,6 +72,12 @@ package or subpackage, the boilerplate will need to be updated
manually. It has the advantage that this change need only be made
once per file, regardless of the number of relative imports.
Note that setting ``__package__`` to the empty string explicitly is
permitted, and has the effect of disabling all relative imports from
that module (since the import machinery will consider it to be a
top level module in that case). This means that tools like ``runpy``
do not need to provide special case handling for top level modules
when setting ``__package__``.
Rationale for Change
====================