From 0f022e6d1dd6feb319c2056d60407d12ab5f6775 Mon Sep 17 00:00:00 2001 From: Nick Coghlan Date: Sun, 1 Feb 2009 13:01:16 +0000 Subject: [PATCH] Add explicit note regarding __package__ in top level modules --- pep-0366.txt | 6 ++++++ 1 file changed, 6 insertions(+) diff --git a/pep-0366.txt b/pep-0366.txt index 14f255c7d..f8b4e6bb6 100644 --- a/pep-0366.txt +++ b/pep-0366.txt @@ -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 ====================