New submission from Serhiy Storchaka <storchaka+cpyt...@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 <rep...@bugs.python.org>
<https://bugs.python.org/issue44636>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to