On 08/26/2013 10:10 PM, random...@fastmail.us wrote:

The reason KeyboardInterrupt and SystemExit inherit from BaseException
is because you often want them to escape (allowing the program to quit)
from code that would otherwise catch them (by catching Exception). On
the contrary, StopIteration is almost always used in a context that
catches it specifically.

But if I want to catch it specifically (except BaseIteration), why
doesn't it hinerit directly from BaseException? It's not an error and it's not a warning. I would like to see a piece of code in which it is useful to catch it generically with a except Exception clause instead of an except StopIteration...
Regards
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to