Skip to content

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

Open
bhuvi27 wants to merge 2 commits into
python:mainfrom
bhuvi27:gh-150837-clarify-closure-wording
Open

gh-150837: Clarify closure wording in function tutorial#151038
bhuvi27 wants to merge 2 commits 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.

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

read-the-docs-community Bot commented Jun 7, 2026

Documentation build overview

📚 cpython-previews | 🛠️ Build #33031362 | 📁 Comparing 46c6eca against main (ab93017)

  🔍 Preview build  

4 files changed
± howto/functional.html
± library/stdtypes.html
± tutorial/controlflow.html
± whatsnew/changelog.html

@python-cla-bot
Copy link
Copy Markdown

python-cla-bot Bot commented Jun 8, 2026

The following commit authors need to sign the Contributor License Agreement:

CLA not signed

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