GeezerVison is showing github.com — Deprecate typing.Hashable/Sized · Issue #94309 · python/cpython
Deprecate typing.Hashable/Sized #94309Descriptiontyping.Hashable and typing.Sized are aliases to their equivalents in the collections.abc module; PEP 585 deprecated all aliases like these while aiming to remove the duplication between the two modules, but the aforementioned two seem to have been left out of that because they're not generic.
If the others are deprecated, I don't think it makes sense to keep them when they're just aliases that provide no additional functionality
Linked PRs
Reacted by Jelle Zijlstra and Alex Waygood ActivityFidget-Spinner commented on Jun 27, 2022 I'm +1 for deprecating them too. Before that, I'm interested as to why we have these aliases in typing? Are they just for convenience? Searching commit history, I think @gvanrossum might have an idea. AlexWaygood commented on Jun 27, 2022 gvanrossum commented on Jun 27, 2022 I agree that we should be consistent. MonadChains commented on Jul 5, 2022 Hi, I'm new to the Python codebase, and I would like to contribute to it. I have a question about this issue: what is the deprecation procedure for the aliases? According to PEP 585, the deprecated aliases should not trigger any DeprecationWarning and only type checkers should warn of their usage. So I'm not sure what are exactly the changes needed. JelleZijlstra commented on Jul 5, 2022 I think we should just add a deprecation notice in the docs, similar to that for typing.Iterable and similar. We don't need any runtime behavior change. Reacted by Alex Waygood and MonadChains Fidget-Spinner commented on Jul 6, 2022 @MonadChains thanks for your interest in contributing. Here's what you have to do after cloning cpython.
- Go to /Doc/library/typing.rst.
- Copy one of the
.. deprecated:: notices and paste it under the appropriate sections those types. Edit the text saying to use the type in collections.abc
- Build the documentation with either
make html or ./Doc/make.bat html. View the html output in ./Doc/build/.
- The file uses reStructuredText for documentation. I suggest reading this guide as there may be surprising things to beginners (such as indents using 3 spaces instead of 4!).
Reacted by Alex Waygood and MonadChains AlexWaygood commented on Jul 10, 2022 AlexWaygood commented on Jul 10, 2022 MonadChains commented on Jul 10, 2022
Reopening as per #94626 (comment)
I've opened a new pull request to add the missing part. Reacted by Hugo van Kemenade added a commit that references this issue on Jul 14, 2022gh-94309: Add typing.Hashable and typing.Sized for "What's New for Py… added a commit that references this issue on Nov 17, 2023gh-94309: "What's new in Python 3.12": improve deprecation notice for…
MetadataMetadataDevelopmentNo branches or pull requestsIssue actions
|