You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
This repository was archived by the owner on Jul 5, 2023. It is now read-only.
If typeshed would start using Python 3.8 only features, such as positional-only arguments, tools such as mypy that use typed-ast when running under 3.7 or earlier would sometimes be unable to parse those stubs, since typed-ast won't get any post-3.7 features according to current policies. This seems to rule out using 3.8 features in typeshed. Similarly, in case Python 3.9 introduces a new syntax for optional types, for example, it looks like we wouldn't be able to use that syntax in typeshed (at least for several years).
I see a few options that could help with the issue:
Work towards establishing a typeshed policy that stubs should only use syntax that is supported by the oldest maintained Python 3+ release (currently that would be 3.5). We actually already use 3.6 syntax in typeshed, but we could make it an exception.
Revert to the original policy of backporting all new Python syntax to typed-ast.
Option 1 could become a problem in a few scenarios that don't seem totally implausible:
An existing keyword stops being a keyword, so older Python parsers won't be able to represent identifiers with that name. This could mean that we can't represent some stdlib module stubs precisely.
Some new type related syntax gets introduced for which we can't design a good fallback syntax for older Python releases.