[issue8435] It is possible to observe a mutating frozenset

Gath-Gealaich report at bugs.python.org
Sun Apr 18 17:55:46 CEST 2010

Gath-Gealaich <gathgealaich at gmail.com> added the comment:

I have found this in Python 3.1.2 documentation:

"Note, the elem argument to the __contains__(), remove(), and discard() methods may be a set. To support searching for an equivalent frozenset, the elem set is temporarily mutated during the search and then restored. During the search, the elem set should not be read or mutated since it does not have a meaningful value."

I seems to me that this is precisely what happens in this code. Now we might argue whether this is an acceptable state of affairs, but at least it's a documented behavior (and people shouldn't write equality predicates like this anyway. ;)).

nosy: +ggeal

Python tracker <report at bugs.python.org>

More information about the Python-bugs-list mailing list