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
In the latest version of typing_extensions, several performance improvements (and several bugfixes) from Python 3.12 have been backported to typing_extensions.Protocol. The upshot of this is that isinstance() checks against runtime-checkable protocols may be 20x faster or more if you're using typing_extensions.Protocol. The same rationale applies for why a user might want to use typing_extensions.SupportsIndex rather than typing.SupportsIndex.
The latest version of typing_extensions also backports the implementation of typing.NewType from Python 3.10 to older Python versions. In Python 3.10, NewType is implemented as a class, which makes newtypes pickleable; on earlier versions of Python, newtypes were not pickleable. (This backport was done in response to a request from a user who was struggling to use multiprocessing with typing.NewType on older Python versions due to the fact that newtypes could not be pickled.)
The text was updated successfully, but these errors were encountered:
Hi, thanks so much for pyupgrade -- I think it's a fantastic tool.
When run with e.g. the
--py39-plus
flag, pyupgrade will currently make the following changes, which are perhaps overly aggressive:In the latest version of typing_extensions, several performance improvements (and several bugfixes) from Python 3.12 have been backported to
typing_extensions.Protocol
. The upshot of this is thatisinstance()
checks against runtime-checkable protocols may be 20x faster or more if you're usingtyping_extensions.Protocol
. The same rationale applies for why a user might want to usetyping_extensions.SupportsIndex
rather thantyping.SupportsIndex
.The latest version of
typing_extensions
also backports the implementation oftyping.NewType
from Python 3.10 to older Python versions. In Python 3.10,NewType
is implemented as a class, which makes newtypes pickleable; on earlier versions of Python, newtypes were not pickleable. (This backport was done in response to a request from a user who was struggling to usemultiprocessing
withtyping.NewType
on older Python versions due to the fact that newtypes could not be pickled.)The text was updated successfully, but these errors were encountered: