Message397567
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). |
|
Date |
User |
Action |
Args |
2021-07-15 16:28:49 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, gvanrossum, kj |
2021-07-15 16:28:49 | serhiy.storchaka | set | messageid: <1626366529.09.0.940643989656.issue44646@roundup.psfhosted.org> |
2021-07-15 16:28:49 | serhiy.storchaka | link | issue44646 messages |
2021-07-15 16:28:49 | serhiy.storchaka | create | |
|