473,386 Members | 1,827 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,386 software developers and data experts.

Dive into Python question

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?

Aug 26 '06 #1
2 2390
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

Aug 26 '06 #2
Thanks, after I looked into it I realized that the output order can
change arbitarily. It just seems kind of strange that the first example
is one where your output might not match what the author tells you it
should be - and yet there's no mention of this in the book (at least at
that point.)

Aug 26 '06 #3

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: Luis P. Mendes | last post by:
Hi, do you know if is there any 'Dive into Python' equivalent for the java language? DiP is the best I've seen and I would need to learn some basics of Java and also ways to interact between...
6
by: Franz Mueller | last post by:
Hi, which of the following books would you recommend: "Dive into Python" or "Beginning Python: From Novice to Professional"? I'm an experienced C++-programmer who wants to take a look at...
2
by: Franz Mueller | last post by:
Hi there, is there a nicer looking version of the "Dive into Python" PDF? The one from diveintopython.org looks horrible, much worse than the web-version; also the images aren't where they...
5
by: Casey Hawthorne | last post by:
Since there was talk of if-then-else not being allowed in lambda expressions, the following is from "Dive into Python" The and-or conditional expression trick from page 41 of "Dive into Python"...
3
by: hanumizzle | last post by:
I find Dive Into Python generally an excellent text, and I am not surprised to see people recommending it...but I have noticed a few errors already: ...
1
by: Ben Edwards (lists) | last post by:
I have been going through Dive into Python which up to now has been excellent. I am now working through Chapter 9, XML Processing. I am 9 pages in (p182) in the 'Parsing XML section. The...
51
by: erikcw | last post by:
DiveIntoPython.org was the first book I read on python, and I really got a lot out of it. I need to start learning Java (to maintain a project I've inherited), and was wondering if anyone knew of...
3
by: james_027 | last post by:
Hi, class UserDict: def __init__(self, dict=None): self.data = {} if dict is not None: self.update(dict) I just don't understant this code, as it is not also mention in the book. the update...
0
by: taylorcarr | last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
0
by: aa123db | last post by:
Variable and constants Use var or let for variables and const fror constants. Var foo ='bar'; Let foo ='bar';const baz ='bar'; Functions function $name$ ($parameters$) { } ...
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.