TLDR; This typing PEP proposes a way to specify a type parameter if omitted.
As far as I’m aware the only issue with the PEP from anyone in the typing community is about the way
ParamSpecs should be represented (Question about the representation of ParamSpec Generic classes · Issue #1274 · python/typing · GitHub).
Some previous discussion on typing-sig (Mailman 3 Defaults for TypeVar-likes - Typing-sig - python.org).
Some places this could be useful in the standard library:
collections.abc.Generator- most people don’t use the last 2 type parameters, omitting them should be equivalent to collections.abc.Generator[T, None, None] or Any (I trust the opinions of the typeshed maintainers about this more than my own opinion here).
slicegeneric over the
startparameter should default to
stopdefault to the type of
int | None.
datetime.datetime- for informing people of timezone awareness/naiveness at type time.
timezone | None.
datetime[timezone]would mean timezone-aware
datetimes are expected to be passed,
datetime[timezone | None]means you don’t care about awareness. This is relatively commonplace in other languages’ datetime libraries.
boundcould be changed to
Hashableto give better types and potentially catch more bugs before they reach production respectively.
Happy to answer any questions about this.