mirror of
https://github.com/python/cpython.git
synced 2025-09-30 12:21:51 +00:00
Issue #28073: Improve wording around None. Michael Lee. (3.5->3.6)
This commit is contained in:
commit
f7f8299967
1 changed files with 4 additions and 2 deletions
|
@ -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:
|
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
|
NewType
|
||||||
-------
|
-------
|
||||||
|
|
||||||
|
@ -148,7 +151,6 @@ For example::
|
||||||
It is possible to declare the return type of a callable without specifying
|
It is possible to declare the return type of a callable without specifying
|
||||||
the call signature by substituting a literal ellipsis
|
the call signature by substituting a literal ellipsis
|
||||||
for the list of arguments in the type hint: ``Callable[..., ReturnType]``.
|
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
|
Generics
|
||||||
--------
|
--------
|
||||||
|
@ -443,7 +445,7 @@ The module defines the following classes, functions and decorators:
|
||||||
|
|
||||||
Optional type.
|
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,
|
Note that this is not the same concept as an optional argument,
|
||||||
which is one that has a default. An optional argument with a
|
which is one that has a default. An optional argument with a
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue