-
-
Notifications
You must be signed in to change notification settings - Fork 3k
Closed
Labels
Description
The documentation for NewType
at https://mypy.readthedocs.io/en/stable/more_types.html#newtypes states:
...the typing module provides a helper function
NewType
that creates simple unique types with almost zero runtime overhead.
However, as the cpython documentation for NewType
` states:
Changed in version 3.10:
NewType
is now a class rather than a function. There is some additional runtime cost when callingNewType
over a regular function. However, this cost will be reduced in 3.11.0.
In Python >=3.10, NewType
is a class rather than a function, meaning the mypy documentation is now incorrect.
I'm not immediately sure how it could be rewritten in a more accurate way that is still concise, however.