Class KeyboardInterrupt
- Namespace
- NumSharp
- Assembly
- NumSharp.dll
Python's KeyboardInterrupt: the user pressed the interrupt key (Ctrl+C), which CPython turns into this
error in the running code.
public class KeyboardInterrupt : NumSharpException, ISerializable, INumSharpException
- Inheritance
-
KeyboardInterrupt
- Implements
- Inherited Members
Remarks
In Python it sits beside Exception under BaseException, so except Exception does not catch
it. C# has one root: NumSharp's derives from NumSharpException, and footgun, a
catch (Exception) DOES catch it.
NumSharp never raises it (.NET reports Ctrl+C through CancelKeyPress, not an exception); a port that wants Python's behaviour throws it from its own cancellation check.
Constructors
KeyboardInterrupt()
Creates the error with Python's text for a bare raise KeyboardInterrupt (what CPython raises): an
empty Message, as str(KeyboardInterrupt()) is ''.
public KeyboardInterrupt()
KeyboardInterrupt(string)
Creates the error with the port's message.
public KeyboardInterrupt(string message)
Parameters
messagestringThe text, verbatim.
KeyboardInterrupt(string, Exception)
Creates the error with a message and the exception that caused it: Python's raise
KeyboardInterrupt(message) from innerException (an OperationCanceledException, for
example).
public KeyboardInterrupt(string message, Exception innerException)