| ▲ | mort96 20 hours 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. | ||