On Sun, Aug 16, 2009 at 7:38 PM, Mark Lawrence <breamore...@yahoo.co.uk>wrote:

>
> Blast, I posted the wrong flaming link, sorry everybody.
>

No, don't be sorry. I found your link very informative, and while it's a
little mixed, it could be useful.

I'm really looking for a way to set up Python classes' natural ordering for
sorting purposes. For example, every object of a class could own an
attribute called 'Value'. If I could get Python to sort() a list of classes
with that value, would the key=value parameter work, and is there a better
way than to redefine 3 or more of the rich comparison special methods, etc.

Also, I noticed heapq (the priority queue/heap queue module) doesn't use the
natural sorting order like sorted() does. Just saying. Could someone give it
a try?

Regards,

Ching-Yun "Xavier" Ho, Technical Artist

Contact Information
Mobile: (+61) 04 3335 4748
Skype ID: SpaXe85
Email: cont...@xavierho.com
Website: http://xavierho.com/
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to