On 08/27/2013 08:51 PM, Terry Reedy wrote:

BaseException was added just so it would be possible to catch nearly
everything but a few exceptions. The first two were KeyboardInterrupt
and SystemExit (in 2.5). GeneratorExit was switched in 2.6, but I forget
the details of why.

Maybe in order to don't catch it inside a generator using a except Exception clause, because it is used to notify an active generator is closed:

>>> def foogen():
...     for i in range(10):
...         try:
...             yield i
...         except:
...             print('Catched!')
...             # raise
...
>>> g = foogen()
>>> next(g)
0
>>> g.close()
Catched!
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
RuntimeError: generator ignored GeneratorExit

Do you remember if this is the reason? Thanks,
--
Marco
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to