Terry J. Reedy <tjre...@udel.edu> added the comment:

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.

----------
nosy: +terry.reedy

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue30040>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to