[Python-Dev] PEP 265 - Sorting Dictionaries by Value

Greg Ewing greg@cosc.canterbury.ac.nz
Thu, 23 Aug 2001 15:01:49 +1200 (NZST)


Barry Scott <barry@scottb.demon.co.uk>:

> How should all the variations be handled?

  def order(index = None, field = None, descending = 0):
    ...

Examples:

  from sorting import order

  x.sort(order(index = 3))
  x.sort(order(field = "customer_name", descending = 1))

The next step is to allow sort() itself to take the same
keyword parameters directly:

  x.sort(index = 3)
  x.sort(field = "customer_name", descending = 1)

Greg Ewing, Computer Science Dept, +--------------------------------------+
University of Canterbury,	   | A citizen of NewZealandCorp, a	  |
Christchurch, New Zealand	   | wholly-owned subsidiary of USA Inc.  |
greg@cosc.canterbury.ac.nz	   +--------------------------------------+