[Python-Dev] PEP 265 - Sorting Dictionaries by Value (original) (raw)
Greg Stein gstein@lyra.org
Thu, 23 Aug 2001 06:59:07 -0700
- Previous message: [Python-Dev] PEP 265 - Sorting Dictionaries by Value
- Next message: [Python-Dev] New web utility
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On Thu, Aug 23, 2001 at 03:01:49PM +1200, Greg Ewing wrote:
Barry Scott <barry@scottb.demon.co.uk>:
> How should all the variations be handled? def order(index = None, field = None, descending = 0):
Lose the last arg... call them ascending() and descending(). Sorting already implies an "order" so that name is redundant
... from sorting import order
x.sort(order(index = 3)) x.sort(order(field = "customername", descending = 1))
from sorting import ascending, descending
x.sort(ascending(index = 3)) x.sort(descending(field = 'customer_name'))
The next step is to allow sort() itself to take the same keyword parameters directly:
x.sort(index = 3) x.sort(field = "customername", descending = 1)
eek... no :-)
Cheers, -g
-- Greg Stein, http://www.lyra.org/
- Previous message: [Python-Dev] PEP 265 - Sorting Dictionaries by Value
- Next message: [Python-Dev] New web utility
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]