Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PEP 649 Cleaning up a bit of formatting. #2048

Merged
merged 1 commit into from
Sep 17, 2021
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 5 additions & 3 deletions pep-0649.rst
Original file line number Diff line number Diff line change
Expand Up @@ -326,6 +326,8 @@ from within the language. Therefore it's possible to write code
that behaves differently based on whether annotations are
evaluated at binding time or at access time, e.g.

.. code-block::

mytype = str
def foo(a:mytype): pass
mytype = int
Expand Down Expand Up @@ -364,7 +366,7 @@ module-level scope:
IMO the inability of referencing class-level definitions
from annotations on methods pretty much kills this idea.

https://mail.python.org/pipermail/python-dev/2017-November/150109.html
https://mail.python.org/pipermail/python-dev/2017-November/150109.html

This led to a short discussion about extending lambda-ized
annotations for methods to be able to refer to class-level
Expand All @@ -373,7 +375,7 @@ scope. This idea, too, was quickly rejected.

PEP 563 summarizes the above discussion here:

https://www.python.org/dev/peps/pep-0563/#keeping-the-ability-to-use-function-local-state-when-defining-annotations
https://www.python.org/dev/peps/pep-0563/#keeping-the-ability-to-use-function-local-state-when-defining-annotations

What's puzzling is PEP 563's own changes to the scoping rules
of annotations—it *also* doesn't permit annotations to reference
Expand All @@ -400,7 +402,7 @@ Implementation

There's a prototype implementation of this PEP, here:

https://github.com/larryhastings/co_annotations/
https://github.com/larryhastings/co_annotations/

As of this writing, all features described in this PEP are
implemented, and there are some rudimentary tests in the
Expand Down