Antoine Pitrou added the comment: Ok, PEP 205 explains it a bit more:
"the resulting proxy cannot be used as a dictionary key since it cannot be compared once the referent has expired, and comparability is necessary for dictionary keys. Operations on proxy objects after the referent dies cause weakref.ReferenceError to be raised in most cases." Perhaps this can be relaxed, and comparison simply made to return false. The following behaviour is a bit troubling :-) >>> p <weakproxy at 0x7f4054fe8cd8 to NoneType at 0x88a780> >>> p == p Traceback (most recent call last): File "<stdin>", line 1, in <module> ReferenceError: weakly-referenced object no longer exists ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue24067> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com