On 3/31/06, Nick Coghlan <[EMAIL PROTECTED]> wrote:
> Not a good idea, since the long history of "list.sort()" encourages people to
> think of the sort() method as an inplace operation, which it wouldn't be on a
> view.

Right. This is degenerating quickly. :-(

> "sorted()", on the other hand, already creates a new object. The only
> downside is that Py2.x & Py3k compatible code would look like:
>
>    keys = sorted(d.keys())
>
> which is likely to create the list *twice* in Py2.x.

So write

  keys = sorted(d)

which should work in both versions. :-)

--
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
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