Re: sorting question

2008-03-14 Thread Stefan Behnel
Steven D'Aprano wrote: > On Thu, 13 Mar 2008 22:37:00 -0500, "Andrew Rekdal" wrote: > >> Seems 'KEYBOARDS' works nicely > > in reply to a post from "jcnbp8k" who wrote: > >>> That's easy solved, the word is keyboards. > > Hmmm... using my incredible powers of deduction, I predict that the word

Re: sorting question

2008-03-14 Thread Steven D'Aprano
On Thu, 13 Mar 2008 22:37:00 -0500, "Andrew Rekdal" wrote: > Seems 'KEYBOARDS' works nicely in reply to a post from "jcnbp8k" who wrote: > > That's easy solved, the word is keyboards. Hmmm... using my incredible powers of deduction, I predict that the word is "keyboards". -- Steven -- http

Re: sorting question

2008-03-13 Thread "Andrew Rekdal"
Seems 'KEYBOARDS' works nicely -- -- Andrew "jcnbp8k" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > > Hi Patty, > > That's easy solved, the word is keyboards. > > I just did a google search for 'anagram solver' and got lucky with Andy's > free online anagram solver at http://www

Re: sorting question

2008-03-13 Thread jcnbp8k
Hi Patty, That's easy solved, the word is keyboards. I just did a google search for 'anagram solver' and got lucky with Andy's free online anagram solver at http://www.ssynth.co.uk/~gay/anagram.html :) I know it's not a python script, though are you actually working on a python program to de

Re: sorting question

2007-04-25 Thread Michael Hoffman
belinda thom wrote: > Hi, > > I've had a look at http://wiki.python.org/moin/HowTo/Sorting, but am not > sure if I can get the operator.itemgetter to do what I want for my > particular need. I'm also not sure why creating my own cmp for pulling > tuple parts out and passing it to a list sort do

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
> return [(node.id, node.ord_number) for node in self.get_path()] I meant: > return [(node.ord_number, node.id) for node in self.get_path()] -- Ksenia -- http://mail.python.org/mailman/listinfo/python-list

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
2005/8/10, Peter Otten <[EMAIL PROTECTED]>: > I think you cannot get away with your first rule, but have to operate on the > full path instead. Otherwise the position of inner nodes would sometimes be > determined by their url and sometimes by their ord_number *during* *the* > *same* *sort*. Rrr.

Re: sorting question

2005-08-10 Thread Peter Otten
Ksenia Marasanova wrote: > I want to sort this list with the following rules: > 1. The parent must always come before the children in the list > 2. Nodes with the same parent must be sorted by 'ord_number' > > The first rule is easy, cause I can use 'url' for it. List with nodes > is coming from

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
Example of the wrong sort: class Node: def __init__(self, name, url, order, pid, id): self.name = name self.url = url self.order = order self.pid = pid self.id = id def __repr__(self): return '%s [order: %s]' % (self.url, self.order) def

Re: sorting question

2005-08-10 Thread Ksenia Marasanova
> class Node: > def __init__(self, name, url, order, pid, id): > self.name = name > self.url = url > self.order = order > self.pid = pid > self.id = id > def __repr__(self): > return self

Re: sorting question

2005-08-10 Thread Devan L
Ksenia Marasanova wrote: > Hi, > > I have a list that contains nodes from a tree. Each node is a class > instance, but I'll use dictionary here to simplify the example. > So the list looks like this: > [ > {'id': 1, > 'name': 'Parent node', > 'ord_number': 1, > 'parent_id': 0, > 'url': '/parentnod