Tim Chase  <[EMAIL PROTECTED]> wrote:
>unless you have a way of doing an in-line sort, in which you 
>would be able to do something like
>
>   orderedDict = [(k,mydict[k]) for k in mydict.keys().sort()]
>
>Unfortunately, the version I've got here doesn't seem to support 
>a sort() method for the list returned by keys(). :(

I bet it does, but it doesn't do what you think it does. See
http://docs.python.org/lib/typesseq-mutable.html , in particular
note 7.

What you want is the sorted() function (introduced in 2.4 IIRC).

-- 
\S -- [EMAIL PROTECTED] -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to