Python 3.0, rich comparisons and sorting order

Steven Bethard steven.bethard at gmail.com
Tue Sep 21 14:44:02 EDT 2004


Phil Frost <indigo <at> bitglue.com> writes:
> That's the point. Dicts can't be sorted, but binary trees *must* be.

Ahh, I see.  You're suggesting using binary trees as an implementation of a 
mapping.  Binary trees have so many uses, I wasn't really clear what you were 
suggesting they be used as.  (After I sent my mail, I had (incorrectly) 
determined that you intended them as sets...)

> It's not something that I do often, but it's something that's important to 
> have.

It does come down to a question nearly identical to the one I asked before:
(1) "is there a good use case for wanting to sort a list containing 
incompatible types?" (my previous question)
(2) "is there a good use case for wanting to make a mapping with keys that 
have incompatible types?" (my question to you)

To some degree, (1) has already been answered to my satisfaction by Carlos 
Ribeiro's spreadsheet example.  If you could give me a real world example of 
when you'd want to do (2), I might be more convinced...

Thanks,

Steve




More information about the Python-list mailing list