sys path[: [''' :\\code\\ns \\dir'first 'means current working directorycwd in factsetting the path to include module works the same as it does in earlier pythonseven if same-named namespace directory appears earlier on the pathnamespace packages are used in only in cases that would be errors in earlier pythonsc:\codepy - import ns ns \dir\ns pyns this is also why none of the directories in namespace package is allowed to have __init__ py fileas soon as the import algorithm finds one that doesit returns regular package immediatelyand abandons the path search and the namespace package put more formallythe import algorithm chooses namespace package only at the end of the path scanand stops at steps or if either regular package or module file is found sooner the net effect is that both module files and regular packages anywhere on the module search path have precedence over namespace package directories in the followingfor examplea namespace package called sub exists as the concatenation of same-named directories under dir and dir on the pathc:\codemkdir ns \dir \sub :\codemkdir ns \dir \sub :\codeset pythonpath= :\code\ns \dir ; :\code\ns \dir :\codepy - import sub sub sub __path__ _namespacepath([' :\\code\\ns \\dir \\sub'' :\\code\\ns \\dir \\sub']much like module filethougha regular package added in the rightmost path entry takes priority over same-named namespace package directories too--the import path scan starts recording namespace package tentatively in dir as beforebut abandons it when the regular package is detected in dir :\codenotepad ns \dir \sub\__init__ py :\codepy - import sub use later reg packagenot same-named directorysub though useful extensionbecause namespace packages are available only to readers using python (and lateri' going to defer to python' manuals for more details on the subject see especially this change' pep document for this change' rationaleadditional detailsand more comprehensive examples python namespace packages