[Tutor] /tutorial/controlflow.html Apologies
Pierre-Michel Averseng
pierre at averseng.re
Mon Dec 2 15:50:41 CET 2013
Hmmm,
I beg your pardon !
> (Yes, this is the correct code. Look closely: the else clause belongs
> to the for
> <http://docs.python.org/3/reference/compound_stmts.html#for> loop,
> *not* the if
> <http://docs.python.org/3/reference/compound_stmts.html#if> statement.)
>
> When used with a loop, the else clause has more in common with the
> else clause of a try
> <http://docs.python.org/3/reference/compound_stmts.html#try> statement
> than it does that of if
> <http://docs.python.org/3/reference/compound_stmts.html#if>
> statements: a try
> <http://docs.python.org/3/reference/compound_stmts.html#try>
> statement’s else clause runs when no exception occurs, and a loop’s
> else clause runs when no break occurs. For more on the try
> <http://docs.python.org/3/reference/compound_stmts.html#try> statement
> and exceptions, see /Handling Exceptions/
> <http://docs.python.org/3/tutorial/errors.html#tut-handling>.
>
Yes the python.org/3/tutorial is good !
Python 3.3 is very different from Python 2 !!
Regards
Pierre
More information about the Tutor
mailing list