Antony Lee added the comment: The use case is to generate a mapping of weakly-held objects to unique ids, with something like
id_map = WeakKeyDictionaryWithMissing(lambda *, _counter=itertools.count(): next(_counter)) 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 -- but this is as well an argument for not having defaultdict in the first place. ---------- _______________________________________ 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