[doc] Leverage the fact that the actual types can now be indexed for typing (GH-22340)
This shows users that they can use the actual types. Using deprecated types is confusing.
This also prefers colections.abc.Sized instead of the alias typing.Sized. I guess the aliases were created to make it convenient to import all collections related types from the same place.
This should be backported to 3.9.
Automerge-Triggered-By: @gvanrossum
diff --git a/Doc/glossary.rst b/Doc/glossary.rst
index 7be755e..9fdbdb1 100644
--- a/Doc/glossary.rst
+++ b/Doc/glossary.rst
@@ -1084,19 +1084,15 @@
Type aliases are useful for simplifying :term:`type hints <type hint>`.
For example::
- from typing import List, Tuple
-
def remove_gray_shades(
- colors: List[Tuple[int, int, int]]) -> List[Tuple[int, int, int]]:
+ colors: list[tuple[int, int, int]]) -> list[tuple[int, int, int]]:
pass
could be made more readable like this::
- from typing import List, Tuple
+ Color = tuple[int, int, int]
- Color = Tuple[int, int, int]
-
- def remove_gray_shades(colors: List[Color]) -> List[Color]:
+ def remove_gray_shades(colors: list[Color]) -> list[Color]:
pass
See :mod:`typing` and :pep:`484`, which describe this functionality.