mirror of
https://github.com/python/cpython.git
synced 2025-08-04 17:08:35 +00:00
bpo-28556: Don't simplify unions at runtime (GH-6841)
This commit is contained in:
parent
5634331a76
commit
f65e31fee3
4 changed files with 21 additions and 45 deletions
|
@ -961,16 +961,15 @@ The module defines the following classes, functions and decorators:
|
|||
|
||||
Union[int, str] == Union[str, int]
|
||||
|
||||
* When a class and its subclass are present, the latter is skipped, e.g.::
|
||||
|
||||
Union[int, object] == object
|
||||
|
||||
* You cannot subclass or instantiate a union.
|
||||
|
||||
* You cannot write ``Union[X][Y]``.
|
||||
|
||||
* You can use ``Optional[X]`` as a shorthand for ``Union[X, None]``.
|
||||
|
||||
.. versionchanged:: 3.7
|
||||
Don't remove explicit subclasses from unions at runtime.
|
||||
|
||||
.. data:: Optional
|
||||
|
||||
Optional type.
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue