[docs] minor error in Tutorial section 4.4

Andrew Svetlov andrew.svetlov at gmail.com
Mon Nov 19 16:56:20 CET 2012


Please note: in python 2 `print` is statement, starting from 3.0 it is function.
So tutorial is completely correct: compare
http://docs.python.org/2/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops
and http://docs.python.org/3/tutorial/controlflow.html#break-and-continue-statements-and-else-clauses-on-loops

On Tue, Nov 13, 2012 at 4:23 PM, Julia Marshall
<marshall at bgc-jena.mpg.de> wrote:
> Hello,
>
> this is really a small thing, but there's an inconsistency between the input
> and output in the second example (showing the "continue" statement) in
> section 4.4 of the tutorial.  The example reads as follows:
>
>
>>>> for num in range(2, 10):
> ...     if num % 2 == 0:
> ...         print("Found an even number", num)
> ...         continue
> ...     print("Found a number", num)
> Found an even number 2
> Found a number 3
> Found an even number 4
> Found a number 5
> Found an even number 6
> Found a number 7
> Found an even number 8
> Found a number 9
>
> and it should read like this:
>
>
>>>> for num in range(2, 10):
> ...     if num % 2 == 0:
> ...         print "Found an even number", num
> ...         continue
> ...     print "Found a number", num
> ...
> Found an even number 2
> Found a number 3
> Found an even number 4
> Found a number 5
> Found an even number 6
> Found a number 7
> Found an even number 8
> Found a number 9
>
>
> Otherwise there are unsightly parentheses and quotation marks in the output.
> I know this is really nit-picking, but the documentation is really good, so
> I figured it might as well be perfect. ;)
>
> Cheers,
>
> -Julia
>
> -------------------------------------------------------
> Julia Marshall, Ph.D.
> Max-Planck-Institut für Biogeochemie
> Hans-Knöll-Str. 10
> 07745 Jena
> Germany
>
> Tel.: +49 (36 41) 57 6383
> Fax.: +49 (36 41) 57 7300
> mobile.: +49 (176) 6433 2265
> email: marshall at bgc-jena.mpg.de
> http://www.bgc-jena.mpg.de/~marshall
> -------------------------------------------------------
>
> _______________________________________________
> docs mailing list
> docs at python.org
> http://mail.python.org/mailman/listinfo/docs
>



-- 
Thanks,
Andrew Svetlov


More information about the docs mailing list