Antony Lee added the comment: For my use case, it was easy enough to wrap the `uid = d[obj]` in a try... catch... plus locking.
Using setdefault would cause the counter to be incremented every time. In truth, here I did not care about having consecutive uids, so that would have worked just as well. In real truth, it later turned out that I didn't really need numeric uids anyways; I could just use weakrefs to the object themselves instead. ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue31254> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com