[issue9269] Cannot pickle self-referencing sets

Antoine Pitrou report at bugs.python.org
Fri Jul 16 11:51:53 CEST 2010


Antoine Pitrou <pitrou at free.fr> added the comment:

> The test case in cycle.py tricks set into accepting mutable objects by > creating a class with default __hash__.  This falls into a category of > "don't do it".

I beg to differ. There is a reason we allow people to define __hash__ and that's to define arbitrary hashable types (not only immutable ones).
Furthermore, the default __hash__ (equivalent to id()) is also perfectly useful in some cases.
And in object-oriented designs it is very common to have reference cycles.

----------
nosy: +pitrou

_______________________________________
Python tracker <report at bugs.python.org>
<http://bugs.python.org/issue9269>
_______________________________________


More information about the Python-bugs-list mailing list