Add explicit note regarding __package__ in top level modules
This commit is contained in:
parent
47b1d922f9
commit
0f022e6d1d
|
@ -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
|
manually. It has the advantage that this change need only be made
|
||||||
once per file, regardless of the number of relative imports.
|
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
|
Rationale for Change
|
||||||
====================
|
====================
|
||||||
|
|
Loading…
Reference in New Issue