[Python-3000] Nix dict.copy()
Guido van Rossum
guido at python.org
Wed Feb 13 00:15:31 CET 2008
On Feb 12, 2008 3:11 PM, Daniel Stutzbach
<daniel at stutzbachenterprises.com> wrote:
> On Feb 12, 2008 4:52 PM, Guido van Rossum <guido at python.org> wrote:
> > > What useful information do we get by knowing that a type has a .copy()
> > > method?
> > It rules out all classes that don't have one. That's nearly all types.
> Okay, but turn it around for a minute. Which types should have a .copy()
> method and why?
> If I'm making a new copyable type, is there a rule of thumb that helps me
> decide on .copy(), .__copy__(), or both?
> Rules of "dict and set have a .copy() method" or "mapping types have a
> .copy() method" seem... arbitrary.
I can't answer those questions in the abstract; I'd have to see the
type you are trying to create and the use case for creating copies.
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000