[Python-3000] Nix dict.copy()

Phillip J. Eby pje at telecommunity.com
Mon Feb 11 03:02:22 CET 2008


At 11:46 PM 2/10/2008 +0000, Paul Moore wrote:
>If I want a copy of an arbitrary mapping (or any object) and I want to
>preserve type, I would use copy.copy(). This is just as polymorphic as
>a copy method (interesting that it is Phillip arguing for methods
>being the polymorphic choice, when copy.copy is a generic function,
>which he has previously argued as being better...)

Actually, the issue here is the import, not methods vs. 
functions.  Otherwise, I'd be arguing for ob.len().  :)

And if we were starting from square one with no existing code, I'd 
probably be okay with needing to import copy, as long as that was the 
publicized One Obvious Way to copy all things.

However, since existing code has to be migrated, and lots of things 
have copy() methods, and 2to3 isn't going to be able to tell, 
practicality (IMO) seems to favor keeping the existing method.



More information about the Python-3000 mailing list