<span class="gmail_quote"></span><br><div><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">How do you get from "some keys can't be ordered" to "it doesn't make
<br>sense for Python to have sorteddict or sortedset"? If you want to use<br>keys that can't be ordered, then feel free to continue to use dict.<br>For situations in which ordering is important, that language should
<br>support that. When did this become an all or nothing proposition?<br>There's plenty of space for both dict and sorteddict.</blockquote><div><br>Sorry for premature conclusions. All I wanted to do was remind the potential problems with any "generic" implementation.
<br><br>And I did say, when ordering is important, we are left with two choices:<br>1) Sort explicitly (whenever required) and be prepared to handle exceptions raised during sort operation.<br>2) Have a implicitly "sorted" implementation and handle exceptions at every insertion.
<br><br>I, personally, tend to prefer the former solution. Later case is useful when we have large objects and we do large number of insertions, in which case, per insertion exception handling would be inefficient. Former case, in turn, can be slightly confusing and a bit to debug.