-
-
Notifications
You must be signed in to change notification settings - Fork 31.8k
typing docs: Use soft deprecation #132941
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Comments
I had assumed that merging the two types would mean the A |
In general I see |
I'm generally in favor, except for blanket deprecating |
I would like to soft deprecate |
I have no strong opinion on The other proposed soft deprecations all sound reasonable to me. I'm not wild about using the term "soft deprecation" in documentation, as I don't think it's self-evident to users what it means for something to be "soft-deprecated": you almost always need some explanation of what some specific soft deprecation actually means, practically, if you want users to have clarity about what API is good to use and what isn't. (The existing soft deprecations in But that's just about how we describe the soft deprecations in the docs, not about whether we do them or not. |
FWIW I agree with soft-deprecating |
A while ago we introduced the concept of "soft deprecation" in PEP 387 (https://peps.python.org/pep-0387/#soft-deprecation): for things that we no longer recommend using, but which we aren't planning to remove in the near future.
The typing docs already list four classes of objects that are deprecated without a scheduled removal (https://docs.python.org/3.14/library/typing.html#deprecation-timeline-of-major-features):
List
)Text
Hashable
andSized
TypeAlias
I'd like to also soft-deprecate the following:
Optional
(obviated by PEP-604)NoReturn
(preferNever
)typing.ForwardRef
(deprecated alias forannotationlib.ForwardRef
)types.UnionType
(deprecated alias fortyping.Union
)Union
using subscripting (Union[A, B]
instead ofA | B
) (PEP-604)TypeVar
,ParamSpec
, orTypeVarTuple
using the constructor directly (PEP-695)Generic
(PEP-695)None of those will be removable for many years if ever, but I think it's useful to have a clear statement in the docs that the newer syntax is preferred.
The text was updated successfully, but these errors were encountered: