Feb. 20, 2014
11:54 p.m.
On 20 February 2014 23:51, Steven D'Aprano <steve@pearwood.info> wrote:
IndexError can also be caught by for-loops, under some circumstances. (See the legacy sequence protocol for iteration.)
Only if your code is actually using the legacy sequence protocol:
def f(): yield 2; raise IndexError ... for x in f(): ... print(x) ... 2 Traceback (most recent call last): File "<stdin>", line 1, in <module> File "<stdin>", line 1, in f IndexError
Oscar