Skip to content

Commit 90edd32

Browse files
committed
docs changes too
1 parent 0bd5345 commit 90edd32

1 file changed

Lines changed: 18 additions & 18 deletions

File tree

Doc/library/typing.rst

Lines changed: 18 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -719,8 +719,8 @@ The :data:`Any` type
719719
====================
720720

721721
A special kind of type is :data:`Any`. A static type checker will treat
722-
every type as being compatible with :data:`Any` and :data:`Any` as being
723-
compatible with every type.
722+
every type as assignable to :data:`Any` and :data:`Any` as assignable to
723+
every type.
724724

725725
This means that it is possible to perform any operation or method call on a
726726
value of type :data:`Any` and assign it to any variable::
@@ -785,7 +785,7 @@ it as a return value) of a more specialized type is a type error. For example::
785785
hash_a(42)
786786
hash_a("foo")
787787

788-
# Passes type checking, since Any is compatible with all types
788+
# Passes type checking, since Any is assignable to all types
789789
hash_b(42)
790790
hash_b("foo")
791791

@@ -851,8 +851,8 @@ using ``[]``.
851851

852852
Special type indicating an unconstrained type.
853853

854-
* Every type is compatible with :data:`Any`.
855-
* :data:`Any` is compatible with every type.
854+
* Every type is assignable to :data:`Any`.
855+
* :data:`Any` is assignable to every type.
856856

857857
.. versionchanged:: 3.11
858858
:data:`Any` can now be used as a base class. This can be useful for
@@ -1292,7 +1292,7 @@ These can be used as types in annotations. They all support subscription using
12921292

12931293
:data:`ClassVar` accepts only types and cannot be further subscribed.
12941294

1295-
:data:`ClassVar` is not a class itself, and should not
1295+
:data:`ClassVar` is not a class itself, and cannot
12961296
be used with :func:`isinstance` or :func:`issubclass`.
12971297
:data:`ClassVar` does not change Python runtime behavior, but
12981298
it can be used by third-party type checkers. For example, a type checker
@@ -2472,9 +2472,9 @@ types.
24722472

24732473
Fields with a default value must come after any fields without a default.
24742474

2475-
The resulting class has an extra attribute ``__annotations__`` giving a
2476-
dict that maps the field names to the field types. (The field names are in
2477-
the ``_fields`` attribute and the default values are in the
2475+
The types for each field name can be retrieved by calling
2476+
:func:`annotationlib.get_annotations` on the resulting class. (The field
2477+
names are in the ``_fields`` attribute and the default values are in the
24782478
``_field_defaults`` attribute, both of which are part of the :func:`~collections.namedtuple`
24792479
API.)
24802480

@@ -2616,7 +2616,7 @@ types.
26162616
Mark a protocol class as a runtime protocol.
26172617

26182618
Such a protocol can be used with :func:`isinstance` and :func:`issubclass`.
2619-
This allows a simple-minded structural check, very similar to "one trick ponies"
2619+
This allows a simple-minded structural check, very similar to "one-trick ponies"
26202620
in :mod:`collections.abc` such as :class:`~collections.abc.Iterable`. For example::
26212621

26222622
@runtime_checkable
@@ -2855,7 +2855,7 @@ types.
28552855
key: T
28562856
group: list[T]
28572857

2858-
A ``TypedDict`` can be introspected via annotations dicts
2858+
A ``TypedDict`` can be introspected via :func:`annotationlib.get_annotations`
28592859
(see :ref:`annotations-howto` for more information on annotations best practices)
28602860
and the following attributes:
28612861

@@ -2982,34 +2982,34 @@ with :deco:`runtime_checkable`.
29822982

29832983
.. class:: SupportsAbs
29842984

2985-
An ABC with one abstract method ``__abs__`` that is covariant
2985+
A protocol with one abstract method ``__abs__`` that is covariant
29862986
in its return type.
29872987

29882988
.. class:: SupportsBytes
29892989

2990-
An ABC with one abstract method ``__bytes__``.
2990+
A protocol with one abstract method ``__bytes__``.
29912991

29922992
.. class:: SupportsComplex
29932993

2994-
An ABC with one abstract method ``__complex__``.
2994+
A protocol with one abstract method ``__complex__``.
29952995

29962996
.. class:: SupportsFloat
29972997

2998-
An ABC with one abstract method ``__float__``.
2998+
A protocol with one abstract method ``__float__``.
29992999

30003000
.. class:: SupportsIndex
30013001

3002-
An ABC with one abstract method ``__index__``.
3002+
A protocol with one abstract method ``__index__``.
30033003

30043004
.. versionadded:: 3.8
30053005

30063006
.. class:: SupportsInt
30073007

3008-
An ABC with one abstract method ``__int__``.
3008+
A protocol with one abstract method ``__int__``.
30093009

30103010
.. class:: SupportsRound
30113011

3012-
An ABC with one abstract method ``__round__``
3012+
A protocol with one abstract method ``__round__``
30133013
that is covariant in its return type.
30143014

30153015
.. _typing-io:

0 commit comments

Comments
 (0)