Dive into Python question

Simon Forman rogue_pedro at yahoo.com
Sat Aug 26 15:27:10 EDT 2006


Fred C. Dobbs wrote:
> I feel like an idiot. I'm going thru "Dive Into Python" and running the
> first program - odbchelper.py
>
> My output is "pwd=secret;database=master;uid=sa;server=mpilgrim" which
> has all the substrings reversed from the output documented in the book.
> I've run the downloaded code in Komodo, PythonWin and the command line
> and get the same results.
>
> Have I set some switch on my python install that reverses everything?

Yeah, that's the '-esrever' switch...

Sorry, just kidding.

Your code's working fine. The thing is dicts do not guarantee any
particular order to their data when you access it.  If you were to
delete a key-value pair and then set it again and print out your dict
again it would quite likely appear in a different order.

I've only ever skimmed DiP, but I'm sure Mark will get to that detail,
probably in section 3.1.

Peace,
~Simon




More information about the Python-list mailing list