On Wed, 2006-04-05 at 16:10 -0400, Muness Alrubaie wrote:
> On a different note, the sorted implementation in util.py is bit less
> handy than it should be, methinks. Here's a patch that works (at
> least for my needs):
>
> - def sorted(iterable, cmp=None, key=None, reverse=False):
> + def sorted(iterable, cmp=None, key=str, reverse=False):
> """Partial implementation of the "sorted" function from Python 2.4"""
> lst = [(key(i), i) for i in iterable]
> lst.sort()
This method is meant give the same result as "sorted" in Python 2.4 for
the implemented parameters ("key" and "reverse"), so "str" cannot be the
default for "key". If you need to sort values based on their string
representation you'll need to explicitly pass the parameter.
--
Matthew Good <[EMAIL PROTECTED]>
_______________________________________________
Trac mailing list
[email protected]
http://lists.edgewall.com/mailman/listinfo/trac