[Python-checkins] cpython (merge 3.5 -> default): Issue #28073: Improve wording around None. Michael Lee. (3.5->3.6)

guido.van.rossum python-checkins at python.org
Sat Sep 10 21:49:40 EDT 2016


https://hg.python.org/cpython/rev/7a4a16a880a4
changeset: 103602:7a4a16a880a4
parent: 103600:c5f9e8f2d9df
parent: 103601:75514816741a
user: Guido van Rossum <guido at python.org>
date: Sat Sep 10 18:49:34 2016 -0700
summary:
 Issue #28073: Improve wording around None. Michael Lee. (3.5->3.6)
files:
 Doc/library/typing.rst | 6 ++++--
 1 files changed, 4 insertions(+), 2 deletions(-)
diff --git a/Doc/library/typing.rst b/Doc/library/typing.rst
--- a/Doc/library/typing.rst
+++ b/Doc/library/typing.rst
@@ -59,6 +59,9 @@
 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 @@
 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 @@
 
 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
-- 
Repository URL: https://hg.python.org/cpython


More information about the Python-checkins mailing list

AltStyle によって変換されたページ (->オリジナル) /