>> [Phillip Eby]
>>> I'm not fond of this idea. dict.copy() is polymorphic -- but dict(d) is...

[Raymond]
>> Can't say dict.copy() is really polymorphic if only one other class defines 
>> the method.

[Martin]
> Why do you say it's only one? I found atleast UserDict.copy, 
> os._Environ.copy, WeakValueDictionary.copy, WeakKeyDictionary.copy,

It would have been better for me to say that copy() seems to appear only in 
variants of dicts, but __copy__() is a long-standing 
defined protocol that is supported across non-mapping types as well.

Underneath the hood, __copy__() and copy() have the same implementation, so 
it's really a question of whether we want two ways to 
say the same thing (with one of those ways being polymorphic across many 
objects and the other being used mainly for dict variants).

Had copy() been a builtin, we probably wouldn't be having this discussion.


Raymond
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to