[Python-3000] Nix dict.copy()

Guido van Rossum guido at python.org
Sat Feb 9 02:03:13 CET 2008


On Feb 8, 2008 4:51 PM, Raymond Hettinger <python at rcn.com> 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.
> * The collections.Mapping ABC does not support copy().
> * copy() is not a universal feature of mapping like objects
> * Lists do not have a copy() method.
> * If we drop dict.copy(), I'll can also drop set.copy() which is unneeded.
>
> Let's make the basic APIs as clean and parallel as possible.

Makes sense.  I request that you also implement the transitional code:
either a fixer for 2to3 or (perhaps more realistically) a warning to
dict.copy() when -3 is given.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)


More information about the Python-3000 mailing list