From 073d9b3d10469c8b63f6b1fe8e36d73493667346 Mon Sep 17 00:00:00 2001 From: Nick Coghlan Date: Tue, 27 Jun 2006 12:27:50 +0000 Subject: [PATCH] Add a note about the dependency between relative imports and the value in '__name__' --- pep-0328.txt | 9 +++++++++ 1 file changed, 9 insertions(+) diff --git a/pep-0328.txt b/pep-0328.txt index 23671a323..d65bf5de1 100644 --- a/pep-0328.txt +++ b/pep-0328.txt @@ -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