gh-74929: PEP 667 general docs update
- expand on What's New entry for PEP 667 (including porting notes)
- review (and update) all mentions of
localsandf_localsin documentation - define "optimised scope" as a new glossary term
C API documentation updates will be added in a separate PR
- Issue: gh-74929
📚 Documentation preview 📚: https://cpython-previews--119201.org.readthedocs.build/
In addition to the inline notes in the PR, I also need to search for references to f_locals to see if any of those need changing.
Does the following refer to something other than the c-api/frame.rst changes?
C API documentation updates will be added in a separate PR
I did not see any grammar or spelling issues.
Does the following refer to something other than the
c-api/frame.rstchanges?
There are several C API additions and updates as described in the PEP. Most of them will be covered in frame.rst, but there are a few PyEval_* changes to be covered elsewhere.
I realised that I was using the Aus/UK spelling of optimised, while the Python docs generally use US spelling (there were 300+ instances of optimized vs less than 20 uses of optimised, including the additions in this PR).
I also added an inline note to the glossary entry pointing out that most optimizations are applied to all scopes, there's just a subset that are only valid when the local and nonlocal variables names are known at compile time.
To avoid more conflicts with sprint changes, I will merge this version once CI is happy.
Capturing the commit message, just in case something fails before the auto-merge lands:
* expand on What's New entry for PEP 667 (including porting notes)
* define 'optimized scope' as a glossary term
* cover comprehensions and generator expressions in locals() docs
* review all mentions of "locals" in documentation (updating if needed)
* review all mentions of "f_locals" in documentation (updating if needed)
Thanks @ncoghlan for the PR 🌮🎉.. I'm working now to backport this PR to: 3.13. 🐍🍒⛏🤖
GH-119291 is a backport of this pull request to the 3.13 branch.