[New-bugs-announce] [issue46122] Update/fix types.UnionType to types.Union in Built-in Types documentation
Vivek Vashist
report at bugs.python.org
Sat Dec 18 05:15:32 EST 2021
New submission from Vivek Vashist <vivekvashist at gmail.com>:
There is an error in https://docs.python.org/3/library/stdtypes.html#types-union example.
Looks like there is no types.UnionType
BROKEN:
>>> import types
>>> isinstance(int | str, types.UnionType)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
AttributeError: module 'types' has no attribute 'UnionType'. Did you mean: 'FunctionType'?
>>> [att for att in dir(types) if 'Union' in att]
['Union']
>>>
WORKING:
>>> import types
>>>
>>> isinstance(int | str, types.Union)
True
>>>
I'll raise a PR shortly.
----------
assignee: docs at python
components: Documentation
messages: 408839
nosy: docs at python, vivekvashist
priority: normal
severity: normal
status: open
title: Update/fix types.UnionType to types.Union in Built-in Types documentation
versions: Python 3.10
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue46122>
_______________________________________
More information about the New-bugs-announce
mailing list