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 terry.reedy
Recipients Mark.Shannon, josh.r, louielu, methane, r.david.murray, rhettinger, serhiy.storchaka, terry.reedy, tim.peters, vstinner, xiang.zhang
Date 2019-03-12.22:02:27
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1552428147.47.0.841943126177.issue30040@roundup.psfhosted.org>
In-reply-to
Content
Some of my thoughts on this.

Conceptually, I expected that clearing a normal dict should make it an empty normal dict.  I presume that making it instead an empty shared key dict is a matter of efficiency and code simplicity.  If the 'anomaly' is to be corrected, changing .clear would be an alternative.

The fact that this patch 'rescues' people who use .setdefault when collections.defaultdict would be better does not especially persuade me (msg291817).  The dict method doc and docstring could refer to defaultdict for such situations.

In 3.8.0a2, empty sets, like empty dicts, are ready to add. Empty lists in a2 are *not*, so pre-allocation is not universal in CPython for mutable collections.
History
Date User Action Args
2019-03-12 22:02:27terry.reedysetrecipients: + terry.reedy, tim.peters, rhettinger, vstinner, r.david.murray, methane, Mark.Shannon, serhiy.storchaka, josh.r, xiang.zhang, louielu
2019-03-12 22:02:27terry.reedysetmessageid: <1552428147.47.0.841943126177.issue30040@roundup.psfhosted.org>
2019-03-12 22:02:27terry.reedylinkissue30040 messages
2019-03-12 22:02:27terry.reedycreate