copysort patch, was RE: [Python-Dev] inline sort option

Guido van Rossum guido at python.org
Fri Oct 17 23:20:31 EDT 2003


> FWIW, I've posted a patch to implement list.copysort() that
> includes a news announcement, docs, and unittests:
> 
>     www.python.org/sf/825814

Despite my suggesting a better name, I'm not in favor of this (let's
say -0).

For one, this will surely make lots of people write

  for key in D.keys().copysort():
      ...

which makes an unnecessary copy of the keys.  I'd rather continue to
write

  keys = D.keys()
  keys.sort()
  for key in keys:
      ...

--Guido van Rossum (home page: http://www.python.org/~guido/)



More information about the Python-Dev mailing list