How to get the StopIteration value on leaving the for loop

178 Views Asked by At

I saw that there are two new features in Python 3:

  • StopIteration can be given a value by a return statement

  • for loop has the else part that is executed when the StopIteration happens

Seems that it is reasonable to be able to work with the StopIteration.value in the else clause, but I cannot find any reference to it.

0

There are 0 best solutions below