Skip to content

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

Open
bhuvi27 wants to merge 1 commit into
python:mainfrom
bhuvi27:gh-150837-clarify-closure-wording
Open

gh-150837: Clarify closure wording in function tutorial#151038
bhuvi27 wants to merge 1 commit into
python:mainfrom
bhuvi27:gh-150837-clarify-closure-wording

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