On 24/01/2016 20:23, Albert-Jan Roskam wrote:

I appear to have confused the terms "sorted" and "ordered" (see the email I just sent to Mark 
Lawrence).  My OrderedDict was sorted on its keys, because I defined the dict using the result of an SQL query that 
ended with ORDER BY <names of dict keys here>. So in that case I needed a kind of "chameleon" 
datatype: both a mapping and an indexing type [1]
[1] https://docs.python.org/2/reference/datamodel.html#object.__getitem__


Can you use one of the containers here http://www.grantjenks.com/docs/sortedcontainers/ ?

If yes it's as simple as:-

pip install sortedcontainers

--
My fellow Pythonistas, ask not what our language can do for you, ask
what you can do for our language.

Mark Lawrence

_______________________________________________
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor

Reply via email to