sorting a dictionary
Ian Bicking
ianb at colorstudy.com
Thu Feb 6 04:43:39 EST 2003
On Thu, 2003-02-06 at 03:31, Alex Martelli wrote:
> In my case, it's the inconsistency between 2j<'1' working while 2j<1
> doesn't -- if both raised (or neither raised, as in 1.5.2), I could
> see the sense of it. I'd prefer the 1.5.2 behavior (so the subtle
> distinguos I had to draw in this thread were not needed) but I could
> accept "no complex number can EVER be compared with ANYTHING" as
> having some use (and no practical downside wrt the alternative of
> "complex numbers can be compared with strings but not with numbers").
It would be better if there was an alternative to < (or cmp) that was
potentially arbitrary but also stable and would not raise exceptions.
Like maybe "order".
Then, would an entirely arbitrary function be appropriate? Like:
def order(a, b):
return cmp(id(a), id(b))
--
Ian Bicking ianb at colorstudy.com http://colorstudy.com
4869 N. Talman Ave., Chicago, IL 60625 / 773-275-7241
"There is no flag large enough to cover the shame of
killing innocent people" -- Howard Zinn
More information about the Python-list
mailing list