New submission from Vivek Vashist <vivekvash...@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@python components: Documentation messages: 408839 nosy: docs@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 <rep...@bugs.python.org> <https://bugs.python.org/issue46122> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com