-
-
Notifications
You must be signed in to change notification settings - Fork 32k
gh-113208: Mention namespace packages don't require __init__.py #113209
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from 1 commit
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -437,7 +437,8 @@ When importing the package, Python searches through the directories on | |
``sys.path`` looking for the package subdirectory. | ||
|
||
The :file:`__init__.py` files are required to make Python treat directories | ||
containing the file as packages. This prevents directories with a common name, | ||
containing the file as packages (unless using a :term:`namespace package`, a | ||
relatively advanced features). This prevents directories with a common name, | ||
such as ``string``, from unintentionally hiding valid modules that occur later | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So… this line is not true anymore 😢 There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Hi @merwok, could you provide a reference to the updated way, I can open a pr for it. There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Well, now nothing presents a directory on sys.path to shadow a stdlib module name, even without __init__.py file You could open an issue first, then we’ll see if someone creates a PR! |
||
on the module search path. In the simplest case, :file:`__init__.py` can just be | ||
an empty file, but it can also execute initialization code for the package or | ||
|
Uh oh!
There was an error while loading. Please reload this page.