[Python-3000] Nix dict.copy()

Phillip J. Eby pje at telecommunity.com
Sun Feb 10 05:58:35 CET 2008


At 07:51 PM 2/8/2008 -0500, Raymond Hettinger wrote:
>I recommend dropping the dict.copy() method from Py3.0.
>
>* We can already write:  newd = copy.copy(d).
>* We can also write:     newd = dict(d)
>* Both of those approaches also work for most other containers.

I'm not fond of this idea.  dict.copy() is polymorphic -- but dict(d) isn't.

copy.copy() is polymorphic, but requires an import, which means the 
path of least resistance will be to use dict(d)...  which will then 
turn non-dictionaries into dictionaries.

If copy.copy() were a builtin and the "one obvious way" to copy 
containers, +1.  Otherwise, -0.5.



More information about the Python-3000 mailing list