[Python-3000] Nix dict.copy()

Aahz aahz at pythoncraft.com
Mon Feb 11 01:24:00 CET 2008


On Sun, Feb 10, 2008, Christian Heimes wrote:
> Larry Hastings wrote:
>>
>> +1 for exactly the reasons cited.  I think copy() and deepcopy() should
>> both be "essential" built-in functions.
> 
> I'm -0 on copy and -1 on deepcopy.
> 
> If you need a copy or a deepcopy of an object (except dicts, lists and
> sets) you are most certainly using the wrong approach. Back when I was
> learning Python over 5 years ago I was using copy and deepcopy often.
> Nowadays I don't need the copy module anymore because I've learned how
> to design software without the need for copies.

Let's suppose you have an object that represents an order.  And let's
suppose that this object needs to be copied to create a re-order (letting
the customer preserve the information from the original order).  How do
you suggest that the re-order be created without copy(), and especially
deepcopy()?  What if an attribute of orders can be a list or dict?
-- 
Aahz (aahz at pythoncraft.com)           <*>         http://www.pythoncraft.com/

"All problems in computer science can be solved by another level of     
indirection."  --Butler Lampson


More information about the Python-3000 mailing list