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 josh.r
Recipients josh.r, louielu, methane, r.david.murray, serhiy.storchaka, xiang.zhang
Date 2017-04-18.01:44:37
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1492479878.06.0.231847604447.issue30040@psf.upfronthosting.co.za>
In-reply-to
Content
For the record, legitimate case when many empty dicts are created, and few are populated, is the collections-free approach to defaultdict(dict):

    mydict.setdefault(key1, {})[key2] = val

For, say, 100 unique key1s, and 10,000 total key1/key2 pairs, you'd create 10,000 empty dicts, discarding 9,900 of them. Granted, collections.defaultdict(dict) is even better (avoids the 9,900 unused dicts entirely), but I see the setdefault pattern enough, usually with list or dict, that it's not totally unreasonable to account for it.
History
Date User Action Args
2017-04-18 01:44:38josh.rsetrecipients: + josh.r, r.david.murray, methane, serhiy.storchaka, xiang.zhang, louielu
2017-04-18 01:44:38josh.rsetmessageid: <1492479878.06.0.231847604447.issue30040@psf.upfronthosting.co.za>
2017-04-18 01:44:38josh.rlinkissue30040 messages
2017-04-18 01:44:37josh.rcreate