-
-
Notifications
You must be signed in to change notification settings - Fork 32.2k
gh-71261: Add paragraph on shadowing submodules with star imports #107004
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
gh-71261: Add paragraph on shadowing submodules with star imports #107004
Conversation
Doc/tutorial/modules.rst
Outdated
] | ||
|
||
def reverse(msg: str): # <-- this name shadows the 'reverse.py' submodule | ||
return msg[::-1] # in case of an 'from sound.effects import *' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I suggest: "in the case of a ..."
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks. Done.
…ts (pythonGH-107004) (cherry picked from commit 680f3e1) Co-authored-by: wulmer <wulmer@users.noreply.github.com>
GH-107099 is a backport of this pull request to the 3.11 branch. |
GH-107100 is a backport of this pull request to the 3.12 branch. |
…ts (pythonGH-107004) (cherry picked from commit 680f3e1) Co-authored-by: wulmer <wulmer@users.noreply.github.com>
This PR extends the tutorial on modules and packages by adding a paragraph on the
from abc import *
problem in case of duplicate names for submodules and locally defined objects (e.g. functions).It intends to solve #71261 by providing an example of how a locally defined function breaks the import of submodules.
📚 Documentation preview 📚: https://cpython-previews--107004.org.readthedocs.build/