Antoine Pitrou added the comment: > Of course, as always when using defaultdict, it is easy enough to instead > implement this by manually checking if the key is present and store a new id > in this case
Or, better, use setdefault(), since manually checking suffers from a race condition in the weak dictionary case. ---------- _______________________________________ 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