Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

gh-150837: Clarify closure wording in function tutorial#151038

Open
bhuvi27 wants to merge 1 commit into
python:mainpython/cpython:mainfrom
bhuvi27:gh-150837-clarify-closure-wordingbhuvi27/cpython:gh-150837-clarify-closure-wordingCopy head branch name to clipboard
Open

gh-150837: Clarify closure wording in function tutorial#151038
bhuvi27 wants to merge 1 commit into
python:mainpython/cpython:mainfrom
bhuvi27:gh-150837-clarify-closure-wordingbhuvi27/cpython:gh-150837-clarify-closure-wordingCopy head branch name to clipboard

Conversation

@bhuvi27
Copy link
Copy Markdown

@bhuvi27 bhuvi27 commented Jun 7, 2026

Summary

Clarifies that variable references in a function look up names in the local symbol tables of functions enclosing the definition, not the function enclosing the call site.

Fixes #150837

Changes

  • Update wording in Doc/tutorial/controlflow.rst in the "Defining Functions" section.

Documentation-only change; no NEWS entry needed.

Test plan

  • Built docs locally (cd Doc && make html) and verified the updated paragraph renders in tutorial/controlflow.html.

Made with Cursor

Variable lookup uses the local symbol tables of functions enclosing the
definition, not the function enclosing the call site.
@read-the-docs-community
Copy link
Copy Markdown

Documentation build overview

📚 cpython-previews | 🛠️ Build #33024653 | 📁 Comparing d2d0d70 against main (ab93017)

  🔍 Preview build  

1 file changed
± tutorial/controlflow.html

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

awaiting review docs Documentation in the Doc dir skip news

Projects

Status: Todo

Development

Successfully merging this pull request may close these issues.

Tutorial on defining functions has potentially misleading explanation of closure

2 participants

Morty Proxy This is a proxified and sanitized view of the page, visit original site.