[docs] Documentation bug?
chriswallis at littlewindsor.co.uk
Sun Mar 10 20:37:13 CET 2013
In section 4.1....
4.1. if <http://docs.python.org/2/reference/compound_stmts.html#if>Statements
Perhaps the most well-known statement type is the
The for <http://docs.python.org/2/reference/compound_stmts.html#for>statement
in Python differs a bit from what you may be used to in C or
Pascal. Rather than always iterating over an arithmetic progression of
numbers (like in Pascal), or giving the user the ability to define both the
iteration step and halting condition (as C), Python’s
iterates over the items of any sequence (a list or a string), in
the order that they appear in the sequence. For example (no pun intended):
>>> # Measure some strings:... words = ['cat', 'window', 'defenestrate']>>> for w in words:... print w, len(w)...cat 3window 6defenestrate 12
If I enter this code into the interpreter, I get a syntax error at
print w, len(w)
My apologies if the problem is in my understanding: I'm new at Python..
-------------- next part --------------
An HTML attachment was scrubbed...
More information about the docs