Skip to content

Commit

Permalink
PEP 747: Fix code block formatting. Fix grammar. (#4006)
Browse files Browse the repository at this point in the history
  • Loading branch information
davidfstr authored Sep 29, 2024
1 parent c778ab9 commit a5b63cb
Showing 1 changed file with 6 additions and 7 deletions.
13 changes: 6 additions & 7 deletions peps/pep-0747.rst
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ an overly-wide type like ``object``, which makes some use cases impossible and
generally reduces type safety. This PEP addresses this limitation by
introducing a new special form ``typing.TypeForm``.

This PEP makes no changes to the Python grammar. ``TypeForm`` is
This PEP makes no changes to the Python grammar. Correct usage of ``TypeForm`` is
intended to be enforced only by type checkers, not by the Python runtime.


Expand Down Expand Up @@ -95,13 +95,10 @@ would benefit from ``TypeForm``:
- Assignability checkers:

- Determines whether a value is assignable to a specified type
- Pattern 1:

``def is_assignable[T](value: object, typx: TypeForm[T]) -> TypeIs[T]``

- Pattern 2:
- Pattern 1: ``def is_assignable[T](value: object, typx: TypeForm[T]) -> TypeIs[T]``

``def is_match[T](value: object, typx: TypeForm[T]) -> TypeGuard[T]``
- Pattern 2: ``def is_match[T](value: object, typx: TypeForm[T]) -> TypeGuard[T]``

- Examples: beartype.\ `is_bearable`_, trycast.\ `isassignable`_,
typeguard.\ `check_type`_, xdsl.\ `isa`_
Expand All @@ -119,7 +116,9 @@ would benefit from ``TypeForm``:

- Pattern 1:

``def convert[T](value: object, typx: TypeForm[T]) -> T``
::

def convert[T](value: object, typx: TypeForm[T]) -> T

- Examples: cattrs.BaseConverter.\ `structure`_, trycast.\ `checkcast`_,
typedload.\ `load`_
Expand Down

0 comments on commit a5b63cb

Please sign in to comment.