[New-bugs-announce] [issue36507] frozenset type breaks ZFC

George Shuklin report at bugs.python.org
Tue Apr 2 10:57:33 EDT 2019


New submission from George Shuklin <george.shuklin at gmail.com>:

ZFC (https://en.wikipedia.org/wiki/Zermelo%E2%80%93Fraenkel_set_theory) defines numbers as nested empty sets.

0 is {}
1 is {{}}
2 is {{{}}}

Sets can not be nested in python (as they are mutable), so next best type is frozen set. Unfortunately, nested sets are equal to each other no matter how deep they are nested. This behavior means that 3==2, and it breaks all set operations for ZFC.

Minimal example:

frozenset({frozenset()})
>>> x=frozenset()
>>> y=frozenset(frozenset())
>>> x is y
True

----------
components: Interpreter Core
messages: 339340
nosy: george-shuklin
priority: normal
severity: normal
status: open
title: frozenset type breaks ZFC
type: behavior
versions: Python 3.7

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue36507>
_______________________________________


More information about the New-bugs-announce mailing list