A RetroSearch Logo

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

Search Query:

Showing content from https://mail.python.org/pipermail/python-list/2001-April/085121.html below:

A sorted map type.

A sorted map type. A sorted map type.Mark Pilgrim f8dy at diveintopython.org
Fri Apr 13 19:39:06 EDT 2001
in article slrn9dbfe5.qmh.apardon at trout.vub.ac.be, apardon at trout.vub.ac.be
at apardon at trout.vub.ac.be wrote on 4/12/01 10:33 AM:

> Is there a module that provides a sorted map.
> 
> What I need is a map type that allow you to visit
> all members in key order. Also the possibility
> to look for the next in line after a search
> would be nice. Is there a module that already
> implements such a maptype or do I have to do
> it myself?

>From the Python Cookbook:
  "Dictionaries can't be sorted -- a mapping has no ordering! -- so, when
you feel the need to sort one, you no doubt want to sort its *keys* (in a
separate list). Sorting (key,value) pairs (items) is simplest, but not
fastest."
    http://www.activestate.com/ASPN/Python/Cookbook/Recipe/52306

Article and associated code by Alex Martelli, which, if you're new around
here, means it's definitive.

-M
You're smart; why haven't you learned Python yet?
http://diveintopython.org/


More information about the Python-list 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