New submission from Robert Schuppenies <robert.schuppen...@gmail.com>:
Running this code: >>> import weakref >>> class C: pass ... >>> ws = weakref.WeakSet([C]) >>> if ws == 1: ... print(1) ... gives me the following exception: Traceback (most recent call last): File "<stdin>", line 1, in <module> File "/home/bob/python/svn/py3k/Lib/_weakrefset.py", line 121, in __eq__ return self.data == set(ref(item) for item in other) TypeError: 'int' object is not iterable Looking at _weakrefset.py line 121 gives def __eq__(self, other): return self.data == set(ref(item) for item in other) which treats any 'other' object as a set like object. Therefore comparing WeakSet to a non-set-like object always fails. Do I understand it correctly and if so, is this the intended behavior? ---------- components: Library (Lib) messages: 87420 nosy: schuppenies severity: normal status: open title: WeakSet cmp methods type: behavior versions: Python 3.0, Python 3.1 _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue5964> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com