diff --git a/pep-0420.txt b/pep-0420.txt index 3dba5fde8..682aea35b 100644 --- a/pep-0420.txt +++ b/pep-0420.txt @@ -114,19 +114,30 @@ namespace package creation. There will be no marker file or directory for specifing a namespace package. During import processing, the import machinery will continue to -iterate over the parent path as it does in Python 3.2. While looking -for a module or package named "foo": +iterate over each directory in the parent path as it does in Python +3.2. While looking for a module or package named "foo", for each +directory in the parent path: - * If ``foo/__init__.py`` is found, a regular package is imported. - * If not, but ``foo.{py,pyc,so,pyd}`` is found, a module is imported. - * If not, but ``foo`` is found and is a directory, it is recorded. + * If ``/foo/__init__.py`` is found, a regular package is + imported and returned. -If the scan along the parent path completes without finding a module -or package and at least one directory was recorded, then a namespace -package is created. The new namespace package: + * If not, but ``/foo.{py,pyc,so,pyd}`` is found, a module + is imported and returned. + + * If not, but ``/foo`` is found and is a directory, it is + recorded and the scan continues with the next directory in the + parent path. + + * Otherwise the scan continues with the next directory in the parent + path. + +If the scan completes without returning a module or package, and at +least one directory was recorded, then a namespace package is created. +The new namespace package: * Has a ``__file__`` attribute set to the first directory that was found during the scan, including the trailing path separator. + * Has a ``__path__`` attribute set to the list of directories there were found and recorded during the scan.