A RetroSearch Logo

Home - News ( United States | United Kingdom | Italy | Germany ) - Football scores

Search Query:

Showing content from https://mail.python.org/pipermail/python-dev/2003-October/039236.html below:

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

copysort patch, was RE: [Python-Dev] inline sort option copysort patch, was RE: [Python-Dev] inline sort optionDelaney, Timothy C (Timothy) tdelaney at avaya.com
Tue Oct 21 19:53:01 EDT 2003
> From: Greg Ewing [mailto:greg at cosc.canterbury.ac.nz]
> 
> Maybe dicts should have a .sortedkeys() method? The specialised
> method name would help stave off any temptation to add varied sort
> methods to other types.

-1.

I think that:

    d = {1: 2, 3: 4}

    for i in list.sorted(d):
        print i

or

    d = {1: 2, 3: 4}

    for i in list.sorted(d.iterkeys()):
        print i

looks very clean and unambiguous. And is even better at staving off temptation to add varied sort methods to other types.

Tim Delaney

More information about the Python-Dev mailing list

RetroSearch is an open source project built by @garambo | Open a GitHub Issue

Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo

HTML: 3.2 | Encoding: UTF-8 | Version: 0.7.4