This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author serhiy.storchaka
Recipients gvanrossum, kj, serhiy.storchaka
Date 2021-07-15.16:28:49
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1626366529.09.0.940643989656.issue44646@roundup.psfhosted.org>
In-reply-to
Content
There is a rule: equal hashable objects should have the same hash. The unity type violates it.

>>> x = int | str
>>> y = str | int
>>> x == y
True
>>> hash(x) == hash(y)
False

And hashes of equal unity type and typing.Union are different too.

>>> import typing
>>> z = typing.Union[int, str]
>>> x == z
True
>>> hash(x) == hash(z)
False

There is also a problem with a single type (see issue44636).
History
Date User Action Args
2021-07-15 16:28:49serhiy.storchakasetrecipients: + serhiy.storchaka, gvanrossum, kj
2021-07-15 16:28:49serhiy.storchakasetmessageid: <1626366529.09.0.940643989656.issue44646@roundup.psfhosted.org>
2021-07-15 16:28:49serhiy.storchakalinkissue44646 messages
2021-07-15 16:28:49serhiy.storchakacreate