On Feb 12, 2008 3:11 PM, Daniel Stutzbach <[EMAIL PROTECTED]> wrote: > On Feb 12, 2008 4:52 PM, Guido van Rossum <[EMAIL PROTECTED]> 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/) _______________________________________________ Python-3000 mailing list [email protected] http://mail.python.org/mailman/listinfo/python-3000 Unsubscribe: http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com
