2 ms·
In Python, an iterator raises a StopIteration exception to indicate to the for loop that the iterator is done iterating. In Python, the VM raises a KeyboardInt
by mort96 11mo ago
In Python, an iterator raises a StopIteration exception to indicate to the for loop that the iterator is done iterating.
In Python, the VM raises a KeyboardInterrupt exception when the user hits ctrl+c in order to unwind the stack, run cleanup code and eventually exit the program.
Python is a quite heavy user of exceptions for control flow.