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
Changed in version 3.10: NewType is now a class rather than a function. There is some additional runtime cost when calling NewType 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.
We can just replace "function" with "object". The overhead is still tiny, and it doesn't matter to readers of the mypy documentation exactly how NewType is implemented.
We can just replace "function" with "object". The overhead is still tiny, and it doesn't matter to readers of the mypy documentation exactly how NewType is implemented.
Activity
JelleZijlstra commentedon Nov 26, 2021
We can just replace "function" with "object". The overhead is still tiny, and it doesn't matter to readers of the mypy documentation exactly how NewType is implemented.
Correct documentation for NewType
AlexWaygood commentedon Nov 26, 2021
Makes sense, thanks!
Correct documentation for NewType (#11621)
Correct documentation for NewType (python#11621)