[docs] Documentation bug?

Christopher Wallis 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
if<http://docs.python.org/2/reference/compound_stmts.html#if>statement.
For example:

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
for<http://docs.python.org/2/reference/compound_stmts.html#for>statement
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..

Chris Wallis
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/docs/attachments/20130310/8e7ef15b/attachment.html>


More information about the docs mailing list