Closed
Description
In 3.10, we made a change to disallow usage of yield
, yield from
, await
, and named expressions (walrus) in annotations if from __future__ import annotations
is active. The motivation is that these can have unexpected effects on the enclosing scope, e.g. making it a generator or binding new names.
I am not sure what the status of these is under PEP 649; I checked in with Larry about that.
I think we want to prohibit the same kinds of expressions in type aliases and bounds under PEP 695. There is no static typing use case for them, their runtime behavior would be confusing, and if we ever do get a use case, it's easy to drop the restriction.
Metadata
Metadata
Assignees
Labels
No labels