PEP 747: Fix code block formatting. Fix grammar. (#4006)
This commit is contained in:
parent
c778ab9854
commit
a5b63cb140
|
@ -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.
|
||||
|
||||
|
||||
|
@ -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 1: ``def is_assignable[T](value: object, typx: TypeForm[T]) -> TypeIs[T]``
|
||||
|
||||
- Pattern 2:
|
||||
|
||||
``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`_
|
||||
|
@ -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`_
|
||||
|
|
Loading…
Reference in New Issue