[New-bugs-announce] [issue44636] It is possible to create a 1-type union type
Serhiy Storchaka
report at bugs.python.org
Wed Jul 14 07:04:42 EDT 2021
New submission from Serhiy Storchaka <storchaka+cpython at gmail.com>:
typing.Union always collapsed to a simple type if it contains a single type.
>>> import typing
>>> typing.Union[int, typing.T][int]
<class 'int'>
But the builtin union type can contain a single type:
>>> (int | typing.T)[int]
int
>>> type((int | typing.T)[int])
<class 'types.Union'>
----------
components: Interpreter Core
messages: 397476
nosy: gvanrossum, kj, serhiy.storchaka
priority: normal
severity: normal
status: open
title: It is possible to create a 1-type union type
type: behavior
versions: Python 3.10, Python 3.11
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue44636>
_______________________________________
More information about the New-bugs-announce
mailing list