Thanks to visit codestin.com
Credit goes to github.com

Skip to content
Open
Changes from 1 commit
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Prev Previous commit
a bit more explicit discussion
  • Loading branch information
msullivan committed Apr 16, 2026
commit 36371285597149285bd052b149e386ef0033f9c8
14 changes: 13 additions & 1 deletion peps/pep-0827.rst
Original file line number Diff line number Diff line change
Expand Up @@ -588,7 +588,9 @@ which produce aliases that have some dunder methods overloaded for
Many of the operators specified have type bounds listed for some of
their operands. These should be interpreted more as documentation than
as exact type bounds. Trying to evaluate operators with invalid
arguments will produce an error. (There is some
arguments will produce an error. When this happens, the value of the
failed operator is ``Any``, so that downstream evaluation does not
cascade further errors. (There is some
discussion of potential alternatives :ref:`below <pep827-strict-kinds>`.)

Note that in some of these bounds below we write things like
Expand Down Expand Up @@ -628,6 +630,8 @@ Basic operators
``GetArg[A, B, Literal[0]] == C``
while ``GetArg[A, A, Literal[0]]`` is a type error).

If ``T`` is ``Any``, the result is ``Any``.

Negative indexes work in the usual way.

(Note that runtime evaluators of type annotations are likely
Expand All @@ -644,12 +648,16 @@ Basic operators
arguments of ``T`` when interpreted as ``Base``, or an error if it
cannot be.

If ``T`` is ``Any``, the result is ``Any``.

* ``Length[T: tuple]`` - Gets the length of a tuple as an int literal
(or ``Literal[None]`` if it is unbounded)

* ``Slice[S: tuple, Start: Literal[int | None], End: Literal[int | None]]``:
Slices a tuple type.

If ``S`` is ``Any``, the result is ``Any``.

* ``GetSpecialAttr[T, Attr: Literal[str]]``: Extracts the value
of the special attribute named ``Attr`` from the class ``T``. Valid
attributes are ``__name__``, ``__module__``, and ``__qualname__``.
Expand Down Expand Up @@ -691,9 +699,13 @@ Object inspection
* ``GetMember[T, S: Literal[str]]``: Produces a ``Member`` type for the
member named ``S`` from the class ``T``, or an error if it does not exist.

If ``T`` is ``Any``, the result is ``Any``.

* ``GetMemberType[T, S: Literal[str]]``: Extract the type of the
member named ``S`` from the class ``T``, or ``Never`` if it does not exist.

If ``T`` is ``Any``, the result is ``Any``.

* ``Member[N: Literal[str], T, Q: MemberQuals, Init, D]``: ``Member``,
is a simple type, not an operator, that is used to describe members
of classes. Its type parameters encode the information about each
Expand Down
Loading