New submission from Serhiy Storchaka <storchaka+cpyt...@gmail.com>:
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). ---------- components: Interpreter Core messages: 397567 nosy: gvanrossum, kj, serhiy.storchaka priority: normal severity: normal status: open title: hash() of the unity type is not consistent with equality type: behavior versions: Python 3.10, Python 3.11 _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue44646> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com