PEP 612: Fix typos
This commit is contained in:
parent
ffb78a8542
commit
3c44c60f04
|
@ -228,7 +228,7 @@ inheriting from ``Generic[P]`` makes a class generic on
|
||||||
def f(x: X[int, ...]) -> str: ... # Accepted
|
def f(x: X[int, ...]) -> str: ... # Accepted
|
||||||
def f(x: X[int, int]) -> str: ... # Rejected
|
def f(x: X[int, int]) -> str: ... # Rejected
|
||||||
|
|
||||||
By the rules defined above, spelling an concrete instance of a class generic
|
By the rules defined above, spelling a concrete instance of a class generic
|
||||||
with respect to only a single ``ParamSpec`` would require unsightly double
|
with respect to only a single ``ParamSpec`` would require unsightly double
|
||||||
brackets. For aesthetic purposes we allow these to be omitted.
|
brackets. For aesthetic purposes we allow these to be omitted.
|
||||||
|
|
||||||
|
@ -447,7 +447,7 @@ To extend this to include ``Concatenate``, we declare the following properties:
|
||||||
* A function declared as
|
* A function declared as
|
||||||
``def inner(a: A, b: B, *args: P.args, **kwargs: P.kwargs) -> R``
|
``def inner(a: A, b: B, *args: P.args, **kwargs: P.kwargs) -> R``
|
||||||
has type ``Callable[Concatenate[A, B, P], R]``. Placing keyword-only
|
has type ``Callable[Concatenate[A, B, P], R]``. Placing keyword-only
|
||||||
parameters beterrn the ``*args`` and ``**kwargs`` is forbidden.
|
parameters between the ``*args`` and ``**kwargs`` is forbidden.
|
||||||
|
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
|
@ -462,7 +462,7 @@ To extend this to include ``Concatenate``, we declare the following properties:
|
||||||
return foo # Accepted
|
return foo # Accepted
|
||||||
|
|
||||||
|
|
||||||
def remove(x: Callable[Concatenate[int, P], int]) -> Callable[P, None]:
|
def remove(f: Callable[Concatenate[int, P], int]) -> Callable[P, None]:
|
||||||
|
|
||||||
def foo(*args: P.args, **kwargs: P.kwargs) -> None:
|
def foo(*args: P.args, **kwargs: P.kwargs) -> None:
|
||||||
f(1, *args, **kwargs) # Accepted
|
f(1, *args, **kwargs) # Accepted
|
||||||
|
@ -566,7 +566,7 @@ so:
|
||||||
.. code-block::
|
.. code-block::
|
||||||
|
|
||||||
R = typing.TypeVar(“R”)
|
R = typing.TypeVar(“R”)
|
||||||
Tpositionals = ....
|
Tpositionals = ...
|
||||||
Tkeywords = ...
|
Tkeywords = ...
|
||||||
class BetterCallable(typing.Protocol[Tpositionals, Tkeywords, R]):
|
class BetterCallable(typing.Protocol[Tpositionals, Tkeywords, R]):
|
||||||
def __call__(*args: Tpositionals, **kwargs: Tkeywords) -> R: ...
|
def __call__(*args: Tpositionals, **kwargs: Tkeywords) -> R: ...
|
||||||
|
|
Loading…
Reference in New Issue