mirror of
https://github.com/python/cpython.git
synced 2025-09-29 11:45:57 +00:00
bpo-29879: Update typing documentation. (GH-4573) (GH-4574)
- Add "version added: 3.5.2" note where it was missing.
- Remove the mention that Reversible is new in 3.5.2
(cherry picked from commit 0cd2e81bea
)
This commit is contained in:
parent
04af8ace86
commit
cceb0f8d7b
2 changed files with 13 additions and 1 deletions
|
@ -146,6 +146,8 @@ See :pep:`484` for more details.
|
||||||
``Derived`` is expected. This is useful when you want to prevent logic
|
``Derived`` is expected. This is useful when you want to prevent logic
|
||||||
errors with minimal runtime cost.
|
errors with minimal runtime cost.
|
||||||
|
|
||||||
|
.. versionadded:: 3.5.2
|
||||||
|
|
||||||
Callable
|
Callable
|
||||||
--------
|
--------
|
||||||
|
|
||||||
|
@ -494,6 +496,8 @@ The module defines the following classes, functions and decorators:
|
||||||
``Type[Any]`` is equivalent to ``Type`` which in turn is equivalent
|
``Type[Any]`` is equivalent to ``Type`` which in turn is equivalent
|
||||||
to ``type``, which is the root of Python's metaclass hierarchy.
|
to ``type``, which is the root of Python's metaclass hierarchy.
|
||||||
|
|
||||||
|
.. versionadded:: 3.5.2
|
||||||
|
|
||||||
.. class:: Iterable(Generic[T_co])
|
.. class:: Iterable(Generic[T_co])
|
||||||
|
|
||||||
A generic version of :class:`collections.abc.Iterable`.
|
A generic version of :class:`collections.abc.Iterable`.
|
||||||
|
@ -674,6 +678,8 @@ The module defines the following classes, functions and decorators:
|
||||||
|
|
||||||
A generic version of :class:`collections.defaultdict`.
|
A generic version of :class:`collections.defaultdict`.
|
||||||
|
|
||||||
|
.. versionadded:: 3.5.2
|
||||||
|
|
||||||
.. class:: Counter(collections.Counter, Dict[T, int])
|
.. class:: Counter(collections.Counter, Dict[T, int])
|
||||||
|
|
||||||
A generic version of :class:`collections.Counter`.
|
A generic version of :class:`collections.Counter`.
|
||||||
|
@ -762,6 +768,8 @@ The module defines the following classes, functions and decorators:
|
||||||
def add_unicode_checkmark(text: Text) -> Text:
|
def add_unicode_checkmark(text: Text) -> Text:
|
||||||
return text + u' \u2713'
|
return text + u' \u2713'
|
||||||
|
|
||||||
|
.. versionadded:: 3.5.2
|
||||||
|
|
||||||
.. class:: io
|
.. class:: io
|
||||||
|
|
||||||
Wrapper namespace for I/O stream types.
|
Wrapper namespace for I/O stream types.
|
||||||
|
@ -847,6 +855,8 @@ The module defines the following classes, functions and decorators:
|
||||||
UserId = NewType('UserId', int)
|
UserId = NewType('UserId', int)
|
||||||
first_user = UserId(1)
|
first_user = UserId(1)
|
||||||
|
|
||||||
|
.. versionadded:: 3.5.2
|
||||||
|
|
||||||
.. function:: cast(typ, val)
|
.. function:: cast(typ, val)
|
||||||
|
|
||||||
Cast a value to a type.
|
Cast a value to a type.
|
||||||
|
@ -1054,3 +1064,5 @@ The module defines the following classes, functions and decorators:
|
||||||
"forward reference", to hide the ``expensive_mod`` reference from the
|
"forward reference", to hide the ``expensive_mod`` reference from the
|
||||||
interpreter runtime. Type annotations for local variables are not
|
interpreter runtime. Type annotations for local variables are not
|
||||||
evaluated, so the second annotation does not need to be enclosed in quotes.
|
evaluated, so the second annotation does not need to be enclosed in quotes.
|
||||||
|
|
||||||
|
.. versionadded:: 3.5.2
|
||||||
|
|
|
@ -420,7 +420,7 @@ patch by ingrid.
|
||||||
.. section: Library
|
.. section: Library
|
||||||
|
|
||||||
A new version of typing.py provides several new classes and features:
|
A new version of typing.py provides several new classes and features:
|
||||||
@overload outside stubs, Reversible, DefaultDict, Text, ContextManager,
|
@overload outside stubs, DefaultDict, Text, ContextManager,
|
||||||
Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some of
|
Type[], NewType(), TYPE_CHECKING, and numerous bug fixes (note that some of
|
||||||
the new features are not yet implemented in mypy or other static analyzers).
|
the new features are not yet implemented in mypy or other static analyzers).
|
||||||
Also classes for PEP 492 (Awaitable, AsyncIterable, AsyncIterator) have been
|
Also classes for PEP 492 (Awaitable, AsyncIterable, AsyncIterator) have been
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue