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
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.
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:
types.UnionType (deprecated alias for typing.Union)
I had assumed that merging the two types would mean the types name becomes preferred (as it's an interpreter type). I agree it would be useful to clarify which (or both) of the names to use. I've very likely missed prior discussion on this, though!
In general I see types as the place for interpreter types that don't have a better home. Other typing-related interpreter types (TypeVar, ParamSpec, TypeVarTuple, TypeAliasType) also live in typing not types.
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: