Serhiy Storchaka added the comment: What about difference_update(), issubset(), issuperset(), __eq__()?
Raising TypeError looks reasonable to me. Operations with ordinal sets can raise TypeError for unhashable values. >>> [] in set() Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'list' >>> set().remove([]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'list' >>> set().discard([]) Traceback (most recent call last): File "<stdin>", line 1, in <module> TypeError: unhashable type: 'list' Unlike to set.__contains__ WeakSet.__contains__ returns False for unsupported types: >>> [] in weakref.WeakSet() False Shouldn't set.__contains__ be changed to return False for unhashable values? Or may be make WeakSet.__contains__ raising TypeError for values that can't have weak references? ---------- components: +Library (Lib) nosy: +rhettinger, serhiy.storchaka, stutzbach _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue30100> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com