diff options
author | Jelle Zijlstra <jelle.zijlstra@gmail.com> | 2022-04-29 22:58:40 (GMT) |
---|---|---|
committer | GitHub <noreply@github.com> | 2022-04-29 22:58:40 (GMT) |
commit | 7861a9e3276cf9bf2bfa56d86f29ef06b2456f87 (patch) | |
tree | cb945c992a3124a6ee3194750162e913e14610c5 | |
parent | 53ca774497fde7c5fcf3a84813ea42f95f75c639 (diff) | |
download | cpython-7861a9e3276cf9bf2bfa56d86f29ef06b2456f87.zip cpython-7861a9e3276cf9bf2bfa56d86f29ef06b2456f87.tar.gz cpython-7861a9e3276cf9bf2bfa56d86f29ef06b2456f87.tar.bz2 |
Fix indentation for typing.Unpack docs (#92058)
https://docs.python.org/3.11/library/typing.html#typing.Unpack
-rw-r--r-- | Doc/library/typing.rst | 42 |
1 files changed, 21 insertions, 21 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 0de3805..0f31b90 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -1368,27 +1368,27 @@ These are not used in annotations. They are building blocks for creating generic .. data:: Unpack - A typing operator that conceptually marks an object as having been - unpacked. For example, using the unpack operator ``*`` on a - :class:`type variable tuple <TypeVarTuple>` is equivalent to using ``Unpack`` - to mark the type variable tuple as having been unpacked:: - - Ts = TypeVarTuple('Ts') - tup: tuple[*Ts] - # Effectively does: - tup: tuple[Unpack[Ts]] - - In fact, ``Unpack`` can be used interchangeably with ``*`` in the context - of types. You might see ``Unpack`` being used explicitly in older versions - of Python, where ``*`` couldn't be used in certain places:: - - # In older versions of Python, TypeVarTuple and Unpack - # are located in the `typing_extensions` backports package. - from typing_extensions import TypeVarTuple, Unpack - - Ts = TypeVarTuple('Ts') - tup: tuple[*Ts] # Syntax error on Python <= 3.10! - tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible + A typing operator that conceptually marks an object as having been + unpacked. For example, using the unpack operator ``*`` on a + :class:`type variable tuple <TypeVarTuple>` is equivalent to using ``Unpack`` + to mark the type variable tuple as having been unpacked:: + + Ts = TypeVarTuple('Ts') + tup: tuple[*Ts] + # Effectively does: + tup: tuple[Unpack[Ts]] + + In fact, ``Unpack`` can be used interchangeably with ``*`` in the context + of types. You might see ``Unpack`` being used explicitly in older versions + of Python, where ``*`` couldn't be used in certain places:: + + # In older versions of Python, TypeVarTuple and Unpack + # are located in the `typing_extensions` backports package. + from typing_extensions import TypeVarTuple, Unpack + + Ts = TypeVarTuple('Ts') + tup: tuple[*Ts] # Syntax error on Python <= 3.10! + tup: tuple[Unpack[Ts]] # Semantically equivalent, and backwards-compatible .. versionadded:: 3.11 |