Do interrupts exist in python?

3.6k Views Asked by At

Can you write interrupts in python which can trigger and break program flow as a result of some external event?

In particular suppose you have a thread doing a computation, you want that computation to break and divert program flow to some function if an external event happens. It could complete the operation of the current line but afterward program flow should be directed to another python function.

1

There are 1 best solutions below

1
On

Python is based on the C language so many of its features are also available in Python (Some libraries are actually written in C and compiled for Python). You can look at signal for signals and interrupts