Exceptions as a Control Structure

Olivier Parisy olivier.parisy at free.fr
Mon Aug 9 09:01:38 EDT 2004


Hi all,

I am new to Python (I just finished Guido's tutorial).
I was very surprised to learn there that the StopIteration
is used to end for loops in a standard iterator setting.

I come from C++, where the use of exceptions as control
structures is frowned upon for efficiency reasons.

What is the Python canon on this topic ? Are exceptions
considered as reasonable control structures, or is
StopIteration alone of its kind ?

Regards,
Olivier.




More information about the Python-list mailing list