Skip to content

Commit 4c47274

Browse files
Deploy preview for PR 1226 🛫
1 parent 5d81a04 commit 4c47274

585 files changed

Lines changed: 7119 additions & 7041 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/dataclasses.rst.txt

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -497,7 +497,8 @@ Module contents
497497
.. function:: is_dataclass(obj)
498498

499499
Return ``True`` if its parameter is a dataclass (including subclasses of a
500-
dataclass) or an instance of one, otherwise return ``False``.
500+
dataclass, but not including :ref:`generic aliases <types-genericalias>`)
501+
or an instance of one, otherwise return ``False``.
501502

502503
If you need to know if a class is an instance of a dataclass (and
503504
not a dataclass itself), then add a further check for ``not

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

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -399,6 +399,9 @@ attributes (see :ref:`import-mod-attrs` for module attributes):
399399
Return ``True`` if the object is a class, whether built-in or created in Python
400400
code.
401401

402+
This function returns ``False`` for :ref:`generic aliases <types-genericalias>` of classes,
403+
such as ``list[int]``.
404+
402405

403406
.. function:: ismethod(object)
404407

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

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5783,7 +5783,8 @@ type and the :class:`bytes` data type:
57835783

57845784
``GenericAlias`` objects are instances of the class
57855785
:class:`types.GenericAlias`, which can also be used to create ``GenericAlias``
5786-
objects directly.
5786+
objects directly. Specializations of user-defined :ref:`generic classes <generic-classes>`
5787+
may not be instances of :class:`types.GenericAlias`, but they provide similar functionality.
57875788

57885789
.. describe:: T[X, Y, ...]
57895790

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

Lines changed: 27 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -3480,14 +3480,27 @@ Introspection helpers
34803480

34813481
Determine if a type is a :class:`Protocol`.
34823482

3483-
For example::
3483+
For example:
3484+
3485+
.. testcode::
34843486

34853487
class P(Protocol):
34863488
def a(self) -> str: ...
34873489
b: int
34883490

3489-
is_protocol(P) # => True
3490-
is_protocol(int) # => False
3491+
assert is_protocol(P)
3492+
assert not is_protocol(int)
3493+
3494+
This function only returns true for ``Protocol`` classes, not for
3495+
:ref:`generic aliases <types-genericalias>` of them:
3496+
3497+
.. testcode::
3498+
3499+
class GenericP[T](Protocol):
3500+
def a(self) -> T: ...
3501+
b: int
3502+
3503+
assert not is_protocol(GenericP[int])
34913504

34923505
.. versionadded:: 3.13
34933506

@@ -3510,6 +3523,17 @@ Introspection helpers
35103523
# not a typed dict itself
35113524
assert not is_typeddict(TypedDict)
35123525

3526+
This function only returns true for ``TypedDict`` classes, not for
3527+
:ref:`generic aliases <types-genericalias>` of them:
3528+
3529+
.. testcode::
3530+
3531+
class GenericFilm[T](TypedDict):
3532+
title: str
3533+
year: T
3534+
3535+
assert not is_typeddict(GenericFilm[int])
3536+
35133537
.. versionadded:: 3.10
35143538

35153539
.. class:: ForwardRef

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月 13, 2026 (00:42 UTC)。
359+
最後更新於 5月 14, 2026 (00:43 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月 13, 2026 (00:42 UTC)。
396+
最後更新於 5月 14, 2026 (00:43 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月 13, 2026 (00:42 UTC)。
368+
最後更新於 5月 14, 2026 (00:43 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月 13, 2026 (00:42 UTC)。
580+
最後更新於 5月 14, 2026 (00:43 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月 13, 2026 (00:42 UTC)。
517+
最後更新於 5月 14, 2026 (00:43 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月 13, 2026 (00:42 UTC)。
999+
最後更新於 5月 14, 2026 (00:43 UTC)。
10001000

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

0 commit comments

Comments
 (0)