Skip to content

Commit 3f1f884

Browse files
Deploy preview for PR 1226 🛫
1 parent 4b385cd commit 3f1f884

582 files changed

Lines changed: 742 additions & 685 deletions

File tree

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

pr-preview/pr-1226/_sources/library/typing.rst.txt

Lines changed: 25 additions & 25 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,10 +1292,10 @@ 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
1298-
it can be used by third-party type checkers. For example, a type checker
1298+
it can be used by static type checkers. For example, a type checker
12991299
might flag the following code as an error::
13001300

13011301
enterprise_d = Starship(3000)
@@ -1365,7 +1365,7 @@ These can be used as types in annotations. They all support subscription using
13651365

13661366
def mutate_movie(m: Movie) -> None:
13671367
m["year"] = 1999 # allowed
1368-
m["title"] = "The Matrix" # typechecker error
1368+
m["title"] = "The Matrix" # type checker error
13691369

13701370
There is no runtime checking for this property.
13711371

@@ -2381,9 +2381,9 @@ types.
23812381

23822382
Fields with a default value must come after any fields without a default.
23832383

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

@@ -2457,7 +2457,7 @@ types.
24572457

24582458
Helper class to create low-overhead :ref:`distinct types <distinct>`.
24592459

2460-
A ``NewType`` is considered a distinct type by a typechecker. At runtime,
2460+
A ``NewType`` is considered a distinct type by a type checker. At runtime,
24612461
however, calling a ``NewType`` returns its argument unchanged.
24622462

24632463
Usage::
@@ -2532,7 +2532,7 @@ types.
25322532
Mark a protocol class as a runtime protocol.
25332533

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

25382538
@runtime_checkable
@@ -2723,9 +2723,9 @@ types.
27232723
key: T
27242724
group: list[T]
27252725

2726-
A ``TypedDict`` can be introspected via annotations dicts
2727-
(see :ref:`annotations-howto` for more information on annotations best practices),
2728-
:attr:`__total__`, :attr:`__required_keys__`, and :attr:`__optional_keys__`.
2726+
A ``TypedDict`` can be introspected via :func:`annotationlib.get_annotations`
2727+
(see :ref:`annotations-howto` for more information on annotations best practices)
2728+
and the following attributes:
27292729

27302730
.. attribute:: __total__
27312731

@@ -2766,7 +2766,7 @@ types.
27662766

27672767
For backwards compatibility with Python 3.10 and below,
27682768
it is also possible to use inheritance to declare both required and
2769-
non-required keys in the same ``TypedDict`` . This is done by declaring a
2769+
non-required keys in the same ``TypedDict``. This is done by declaring a
27702770
``TypedDict`` with one value for the ``total`` argument and then
27712771
inheriting from it in another ``TypedDict`` with a different value for
27722772
``total``:
@@ -2848,34 +2848,34 @@ with :deco:`runtime_checkable`.
28482848

28492849
.. class:: SupportsAbs
28502850

2851-
An ABC with one abstract method ``__abs__`` that is covariant
2851+
A protocol with one abstract method ``__abs__`` that is covariant
28522852
in its return type.
28532853

28542854
.. class:: SupportsBytes
28552855

2856-
An ABC with one abstract method ``__bytes__``.
2856+
A protocol with one abstract method ``__bytes__``.
28572857

28582858
.. class:: SupportsComplex
28592859

2860-
An ABC with one abstract method ``__complex__``.
2860+
A protocol with one abstract method ``__complex__``.
28612861

28622862
.. class:: SupportsFloat
28632863

2864-
An ABC with one abstract method ``__float__``.
2864+
A protocol with one abstract method ``__float__``.
28652865

28662866
.. class:: SupportsIndex
28672867

2868-
An ABC with one abstract method ``__index__``.
2868+
A protocol with one abstract method ``__index__``.
28692869

28702870
.. versionadded:: 3.8
28712871

28722872
.. class:: SupportsInt
28732873

2874-
An ABC with one abstract method ``__int__``.
2874+
A protocol with one abstract method ``__int__``.
28752875

28762876
.. class:: SupportsRound
28772877

2878-
An ABC with one abstract method ``__round__``
2878+
A protocol with one abstract method ``__round__``
28792879
that is covariant in its return type.
28802880

28812881
.. _typing-io:
@@ -3595,7 +3595,7 @@ Constant
35953595

35963596
.. data:: TYPE_CHECKING
35973597

3598-
A special constant that is assumed to be ``True`` by 3rd party static
3598+
A special constant that is assumed to be ``True`` by static
35993599
type checkers. It's ``False`` at runtime.
36003600

36013601
A module which is expensive to import, and which only contain types

pr-preview/pr-1226/about.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -356,7 +356,7 @@ <h3>導航</h3>
356356
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
357357
<br>
358358
<br>
359-
最後更新於 5月 21, 2026 (00:45 UTC)。
359+
最後更新於 5月 23, 2026 (00:42 UTC)。
360360

361361
<a href="/bugs.html">發現 bug</a>
362362

pr-preview/pr-1226/bugs.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -393,7 +393,7 @@ <h3>導航</h3>
393393
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
394394
<br>
395395
<br>
396-
最後更新於 5月 21, 2026 (00:45 UTC)。
396+
最後更新於 5月 23, 2026 (00:42 UTC)。
397397

398398
<a href="/bugs.html">發現 bug</a>
399399

pr-preview/pr-1226/c-api/abstract.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -365,7 +365,7 @@ <h3>導航</h3>
365365
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
366366
<br>
367367
<br>
368-
最後更新於 5月 21, 2026 (00:45 UTC)。
368+
最後更新於 5月 23, 2026 (00:42 UTC)。
369369

370370
<a href="/bugs.html">發現 bug</a>
371371

pr-preview/pr-1226/c-api/allocation.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -577,7 +577,7 @@ <h3>導航</h3>
577577
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
578578
<br>
579579
<br>
580-
最後更新於 5月 21, 2026 (00:45 UTC)。
580+
最後更新於 5月 23, 2026 (00:42 UTC)。
581581

582582
<a href="/bugs.html">發現 bug</a>
583583

pr-preview/pr-1226/c-api/apiabiversion.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -514,7 +514,7 @@ <h3>導航</h3>
514514
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
515515
<br>
516516
<br>
517-
最後更新於 5月 21, 2026 (00:45 UTC)。
517+
最後更新於 5月 23, 2026 (00:42 UTC)。
518518

519519
<a href="/bugs.html">發現 bug</a>
520520

pr-preview/pr-1226/c-api/arg.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -996,7 +996,7 @@ <h3>導航</h3>
996996
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
997997
<br>
998998
<br>
999-
最後更新於 5月 21, 2026 (00:45 UTC)。
999+
最後更新於 5月 23, 2026 (00:42 UTC)。
10001000

10011001
<a href="/bugs.html">發現 bug</a>
10021002

pr-preview/pr-1226/c-api/bool.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -376,7 +376,7 @@ <h3>導航</h3>
376376
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
377377
<br>
378378
<br>
379-
最後更新於 5月 21, 2026 (00:45 UTC)。
379+
最後更新於 5月 23, 2026 (00:42 UTC)。
380380

381381
<a href="/bugs.html">發現 bug</a>
382382

pr-preview/pr-1226/c-api/buffer.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1064,7 +1064,7 @@ <h3>導航</h3>
10641064
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
10651065
<br>
10661066
<br>
1067-
最後更新於 5月 21, 2026 (00:45 UTC)。
1067+
最後更新於 5月 23, 2026 (00:42 UTC)。
10681068

10691069
<a href="/bugs.html">發現 bug</a>
10701070

pr-preview/pr-1226/c-api/bytearray.html

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -457,7 +457,7 @@ <h3>導航</h3>
457457
<a href="https://www.python.org/psf/donations/">敬請捐贈。</a>
458458
<br>
459459
<br>
460-
最後更新於 5月 21, 2026 (00:45 UTC)。
460+
最後更新於 5月 23, 2026 (00:42 UTC)。
461461

462462
<a href="/bugs.html">發現 bug</a>
463463

0 commit comments

Comments
 (0)