B
Bengt Richter
Sometimes it could be handy, e.g., cutting short iteration:
... raise self.__class__(self, *args)
...
a class method could be nicer once we have Exception as a new-style class.
Just a thought.
Regards,
Bengt Richter
... raise self.__class__(self, *args)
...
[0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14, 15, 16, 17, 18, 19]>>> Exception.raisex = raisex
>>> list(i for i in xrange(20) if i<10 or StopIteration().raisex()) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9]
>>> list(i for i in xrange(20) if i<15 or StopIteration().raisex()) [0, 1, 2, 3, 4, 5, 6, 7, 8, 9, 10, 11, 12, 13, 14]
>>> list(i for i in xrange(20) if i<25 or StopIteration().raisex())
a class method could be nicer once we have Exception as a new-style class.
Just a thought.
Regards,
Bengt Richter