This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author Antony.Lee
Recipients Antony.Lee, pitrou, rhettinger
Date 2017-08-24.19:53:44
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1503604425.22.0.540161342623.issue31254@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2017-08-24 19:53:45Antony.Leesetrecipients: + Antony.Lee, rhettinger, pitrou
2017-08-24 19:53:45Antony.Leesetmessageid: <1503604425.22.0.540161342623.issue31254@psf.upfronthosting.co.za>
2017-08-24 19:53:45Antony.Leelinkissue31254 messages
2017-08-24 19:53:44Antony.Leecreate