PEP 649: Deferred evaluation of annotations, tentatively accepted

The Python Steering Council is tentatively accepting @larry 's PEP-649: Deferred Evaluation Of Annotations Using Descriptors. (related GH PSC agenda item issue)

Why tentatively? What does that even mean?

It means we think this PEP should be Accepted and recommend that the next Steering Council do so in three months time (long before 3.12 beta 1) unless people can convince us with reasons not to.

While we could’ve just accepted it today, the hole we’d like filled in is what the current experience from projects making use of type annotations at runtime is in regards to the deferred evaluation solution as laid out in the PEP. Are there concerns we’ve overlooked or don’t know about?

-Greg, with a Python Steering Council :rescue_worker_helmet: on

10 Likes

Tentative yay :slight_smile:

What does that mean for string annotations with from __future__ import annotations? PEP 649 suggests that it gets deprecated and eventually removed. But future declarations are supposed to remain forever, so presumably it will just become a no-op.

(We still support the “nested scopes” future declaration even though it hasn’t been needed since, what was it, 2.2 or 2.3?)

During the deprecation period, how do we resolve the conflict if somebody enables both PEP 649 annotation descriptors and PEP 563 stringified annotations?

3 Likes

I think we shouldn’t emit DeprecationWarning for PEP 563, at least 3 releases.

Library authors can not use PEP 649 until they drop Python 3.11 support. PEP 563 is the only efficient and convenient way to use type annotations.

I think it should be syntax error.
Using PEP 649 means that source code doesn’t support Python 3.11. Allowing PEP 563 with PEP 649 doesn’t increase backward compatibility. Authors should chose one.

2 Likes

Or more. Our assumption was that 563’s future import would stay around for a vague long while, so I probably wouldn’t even make a deprecation warning until we find reason to actually plan its demise. If ever.

Will that be our first __future__ import who’s future never came to pass?

They’re parallel futures. Only one gets realized.

2 Likes

from __schrodinger__ import annotations

6 Likes