Matt Williams wrote:
> Dear All,
> 
> I'm trying to write something to calculate rule priorities, based on 
> their provenance (ultimately I'm after a lexicographic ordering)

I don't understand your problem description at all but maybe this will 
help. If you sort a list of lists or a list of tuples it will be a 
lexicographical sort. And the sort() method takes an optional key= 
parameter which is a function that creates a sort key. So if you can 
create a key off your terms then you can sort off that.
> 
> I have a set of terms (the provenances) I'm try to sort. I've done it by 
> associating each possible set of terms with a dictionary, and then using 
> the elements of the set as keys of the dictionary, so that it can look 
> up the values. This is (almost certainly) sub-optimal, but ok for now....

If you have some working code it would probably be helpful to see it. 
Then we can help you improve it.

Kent
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to