Message300800
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. |
|
Date |
User |
Action |
Args |
2017-08-24 19:53:45 | Antony.Lee | set | recipients:
+ Antony.Lee, rhettinger, pitrou |
2017-08-24 19:53:45 | Antony.Lee | set | messageid: <1503604425.22.0.540161342623.issue31254@psf.upfronthosting.co.za> |
2017-08-24 19:53:45 | Antony.Lee | link | issue31254 messages |
2017-08-24 19:53:44 | Antony.Lee | create | |
|