diff options
author | Guido van Rossum <guido@python.org> | 2016-09-11 01:49:34 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 2016-09-11 01:49:34 (GMT) |
commit | f7f82999673836a0768c75b507f700d43759af2b (patch) | |
tree | d66b5631d7671e9b6f02e705789b8953531f9622 /Doc | |
parent | 050af5d89afacaa95d4863a8b09f5e6a8b99f398 (diff) | |
parent | 1816dfe65f5cba50331342d153e99482b18b2d4e (diff) | |
download | cpython-f7f82999673836a0768c75b507f700d43759af2b.zip cpython-f7f82999673836a0768c75b507f700d43759af2b.tar.gz cpython-f7f82999673836a0768c75b507f700d43759af2b.tar.bz2 |
Issue #28073: Improve wording around None. Michael Lee. (3.5->3.6)
Diffstat (limited to 'Doc')
-rw-r--r-- | Doc/library/typing.rst | 6 |
1 files changed, 4 insertions, 2 deletions
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst index 23bcc8c..2f18ffa 100644 --- a/Doc/library/typing.rst +++ b/Doc/library/typing.rst @@ -59,6 +59,9 @@ Type aliases are useful for simplifying complex type signatures. For example:: servers: List[Tuple[Tuple[str, int], Dict[str, str]]]) -> None: ... +Note that ``None`` as a type hint is a special case and is replaced by +``type(None)``. + NewType ------- @@ -148,7 +151,6 @@ For example:: 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)``. Generics -------- @@ -443,7 +445,7 @@ The module defines the following classes, functions and decorators: Optional type. - ``Optional[X]`` is equivalent to ``Union[X, type(None)]``. + ``Optional[X]`` is equivalent to ``Union[X, None]``. Note that this is not the same concept as an optional argument, which is one that has a default. An optional argument with a |