Example 2.1 from Dive Into Python

    I've just started working through Dive Into Python, so I don't really have an opinion of the book yet. I did notice that Example 2.1 produces different output on my machine than from the example...

    The example says I should get:

      
      server=mpilgrim;uid=sa;database=master;pwd=secret
      
      


    I get:

      
      pwd=secret;database=master;uid=sa;server=mpilgrim
      
      


    It's interesting that this is exactly the reverse of what the book says I should get. I have no idea why, as I can't read Python yet, but there you go.

posted at: 11:16 | path: /python/diveintopython | permanent link to this entry

    #1 Stephen Thorne

    The dict object is an unordered hashmap. Order of elements returned by dict.items() is random based on factors like python version, method of insertion, and the phase of the moon.

    #2 Pascal Klein

    I'm going through the same book, right now. On page 16, iirc, and I got the same result for that... =\

    [pwd=secret;database=master;uid=sa;server=mpilgrim]

    Add a comment to this post:

    Your name:

    Your email: Email me new comments on this post
      (Your email will not be published on this site, and will only be used to contact you directly with a reply to your comment if needed. Oh, and we'll use it to send you new comments on this post it you selected that checkbox.)


    Your website:

    Comments: