[Python-checkins] cpython (3.5): Fix trailing ws.
guido.van.rossum
python-checkins at python.org
Wed Aug 5 12:27:39 CEST 2015
https://hg.python.org/cpython/rev/f0cdbc5d2cf3
changeset: 97270:f0cdbc5d2cf3
branch: 3.5
parent: 97268:c8ac5dd318e2
user: Guido van Rossum <guido at python.org>
date: Wed Aug 05 12:26:07 2015 +0200
summary:
Fix trailing ws.
files:
Doc/library/typing.rst | 18 +++++++++---------
1 files changed, 9 insertions(+), 9 deletions(-)
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -47,8 +47,8 @@
on_error: Callable[[int, Exception], None]) -> None:
# Body
-It is possible to declare the return type of a callable without specifying
-the call signature by substituting a literal ellipsis
+It is possible to declare the return type of a callable without specifying
+the call signature by substituting a literal ellipsis
for the list of arguments in the type hint: `Callable[..., ReturnType]`.
`None` as a type hint is a special case and is replaced by `type(None)`.
@@ -182,7 +182,7 @@
Use a literal ellipsis `...` to declare an argument as having a default value::
from typing import AnyStr
-
+
def foo(x: AnyStr, y: AnyStr = ...) -> AnyStr: ...
@@ -277,14 +277,14 @@
.. class:: Tuple
- Tuple type; `Tuple[X, Y]` is the is the type of a tuple of two items
+ Tuple type; `Tuple[X, Y]` is the is the type of a tuple of two items
with the first item of type X and the second of type Y.
Example: `Tuple[T1, T2]` is a tuple of two elements corresponding
to type variables T1 and T2. `Tuple[int, float, str]` is a tuple
of an int, a float and a string.
- To specify a variable-length tuple of homogeneous type,
+ To specify a variable-length tuple of homogeneous type,
use literal ellipsis, e.g. `Tuple[int, ...]`.
.. class:: Callable
@@ -296,9 +296,9 @@
must be a list of types; the return type must be a single type.
There is no syntax to indicate optional or keyword arguments,
- such function types are rarely used as callback types.
- `Callable[..., ReturnType]` could be used to type hint a callable
- taking any number of arguments and returning `ReturnType`.
+ such function types are rarely used as callback types.
+ `Callable[..., ReturnType]` could be used to type hint a callable
+ taking any number of arguments and returning `ReturnType`.
A plain `Callable` is equivalent to `Callable[..., Any]`.
.. class:: Generic
@@ -322,7 +322,7 @@
try:
return mapping[key]
except KeyError:
- return default
+ return default
.. class:: Iterable(Generic[T_co])
--
Repository URL: https://hg.python.org/cpython
More information about the Python-checkins
mailing list