bpo-29879: Update typing documentation. (GH-4573) (GH-4574) · python/cpython@cceb0f8 (original) (raw)

`` @@ -146,6 +146,8 @@ See :pep:484 for more details.

``

146

146

``` Derived is expected. This is useful when you want to prevent logic


`147`

`147`

` errors with minimal runtime cost.

`

`148`

`148`

``

``

`149`

`+

.. versionadded:: 3.5.2

`

``

`150`

`+`

`149`

`151`

`Callable

`

`150`

`152`

`--------

`

`151`

`153`

``

`@@ -494,6 +496,8 @@ The module defines the following classes, functions and decorators:

`

`494`

`496`

```  ``Type[Any]`` is equivalent to ``Type`` which in turn is equivalent

495

497

``` to type, which is the root of Python's metaclass hierarchy.


`496`

`498`

``

``

`499`

`+

.. versionadded:: 3.5.2

`

``

`500`

`+`

`497`

`501`

`.. class:: Iterable(Generic[T_co])

`

`498`

`502`

``

`499`

`503`

``  A generic version of :class:`collections.abc.Iterable`.

``

`@@ -674,6 +678,8 @@ The module defines the following classes, functions and decorators:

`

`674`

`678`

``

`675`

`679`

``  A generic version of :class:`collections.defaultdict`.

``

`676`

`680`

``

``

`681`

`+

.. versionadded:: 3.5.2

`

``

`682`

`+`

`677`

`683`

`.. class:: Counter(collections.Counter, Dict[T, int])

`

`678`

`684`

``

`679`

`685`

``  A generic version of :class:`collections.Counter`.

``

`@@ -762,6 +768,8 @@ The module defines the following classes, functions and decorators:

`

`762`

`768`

` def add_unicode_checkmark(text: Text) -> Text:

`

`763`

`769`

` return text + u' \u2713'

`

`764`

`770`

``

``

`771`

`+

.. versionadded:: 3.5.2

`

``

`772`

`+`

`765`

`773`

`.. class:: io

`

`766`

`774`

``

`767`

`775`

` Wrapper namespace for I/O stream types.

`

`@@ -847,6 +855,8 @@ The module defines the following classes, functions and decorators:

`

`847`

`855`

` UserId = NewType('UserId', int)

`

`848`

`856`

` first_user = UserId(1)

`

`849`

`857`

``

``

`858`

`+

.. versionadded:: 3.5.2

`

``

`859`

`+`

`850`

`860`

`.. function:: cast(typ, val)

`

`851`

`861`

``

`852`

`862`

` Cast a value to a type.

`

`@@ -1054,3 +1064,5 @@ The module defines the following classes, functions and decorators:

`

`1054`

`1064`

```  "forward reference", to hide the ``expensive_mod`` reference from the

1055

1065

` interpreter runtime. Type annotations for local variables are not

`

1056

1066

` evaluated, so the second annotation does not need to be enclosed in quotes.

`

``

1067

+

``

1068

`+

.. versionadded:: 3.5.2

`