PEP 709: Remove obsolete incompatibility subsection (#3030)

This commit is contained in:
Carl Meyer 2023-02-27 19:11:31 -07:00 committed by GitHub
parent cf5741c181
commit 98235c7a0b
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 0 additions and 18 deletions

View File

@ -225,24 +225,6 @@ the library. In such a scenario it would usually be simpler and more reliable
to raise the warning closer to the calling code and bypass fewer frames.
UnboundLocalError instead of NameError
--------------------------------------
Although the value of the comprehension iteration variable is saved and
restored to provide isolation, it still becomes a local variable of the outer
function under this PEP. This implies a small behavior change in a function
where the comprehension iteration variable is accessed outside the
comprehension without ever being set outside the comprehension::
def f(lst):
items = [x for x in lst]
return x
Under this PEP, calling ``f()`` will raise ``UnboundLocalError``, where
currently it raises ``NameError``. ``UnboundLocalError`` is a subclass of
``NameError``, so this should not impact code catching ``NameError``.
How to Teach This
=================