Comments on Dr. Doty's Python Basics
He is describing Python 2.5. There are a number of additional
features in the compatible Python 2.7. Ther latest Python
versions are 3.X (3.1 now, 3.2 shorly). This is a redesign of the
language correctly some of the mistakes, as the creator, Guido van Rossum, saw it. The result
breaks compatibility with 2.X in various places.
p. 9. Python scripts can be run in Windows. They run in a console
window. Inorder to avoid losing the final screen output
imediately, it is best to run them from an existing console window,
rather than being started from a GUI Windows folder.
p. 10. In the introduction, lists and tuples look the same except
for the change from brackets to parentheses. The difference is
that lists are mutable, and tuples are immutable. Also, finite
mathematical sets are built into Python: set([1, 2, 3, 2, 1, 7])
creates a set, eliminating the duplicates of 1 and 2.
p. 11. In all variations of the range function, a parameter gives
a value just PAST the end of the sequence.
p. 15-16. Dr. Doty illustrates Python's peculiar and little used
construction with an else after a while
or a for loop. He does
not say explicitly that the else clause only is executed if the loop is
not exited via a break
statement.
Other than break and continue,
my Hands-on Python Tutorial covers mostly the same topics much slower,
with more about strings (not a big part of our math!), a bit more about
the special Python behavior of boolean opeations, and with the
inclusion of dictionaries.
See JavaVsPython.html. It covers some extra topics.