PEP 649: Fix nested list formatting (#2856)

This commit is contained in:
Peter Law 2022-10-29 14:01:10 +01:00 committed by GitHub
parent 4a2e3e3059
commit a3310aeeff
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
1 changed files with 6 additions and 2 deletions

View File

@ -199,9 +199,11 @@ them to their actual Python values. This has several drawbacks:
implementation. implementation.
* It requires that all annotations be evaluated at module-level * It requires that all annotations be evaluated at module-level
scope. Annotations under :pep:`563` can no longer refer to scope. Annotations under :pep:`563` can no longer refer to
* class variables, * class variables,
* local variables in the current function, or * local variables in the current function, or
* local variables in enclosing functions. * local variables in enclosing functions.
* It requires a code change every time existing code uses an * It requires a code change every time existing code uses an
annotation, to handle converting the stringized annotation, to handle converting the stringized
annotation back into a useful value. annotation back into a useful value.
@ -224,10 +226,12 @@ This PEP also solves the forward reference problem outlined in
* Python implementations would generate annotations as code * Python implementations would generate annotations as code
objects. This is simpler than stringizing, and is something objects. This is simpler than stringizing, and is something
Python implementations are already quite good at. This means: Python implementations are already quite good at. This means:
- alternate implementations would need to write less code to - alternate implementations would need to write less code to
implement this feature, and implement this feature, and
- the implementation would be simpler overall, which should - the implementation would be simpler overall, which should
reduce its ongoing maintenance cost. reduce its ongoing maintenance cost.
* Existing annotations would not need to be changed to only * Existing annotations would not need to be changed to only
use global scope. Actually, annotations would become much use global scope. Actually, annotations would become much
easier to use, as they would now also handle forward easier to use, as they would now also handle forward