Expand description
Exceptions, before there are classes to make them out of.
A Python exception is an instance of a class. Two thirds of that is here:
the builtin classes and their instances are real values a program can name,
call, bind and raise, and they are in exception. What
is missing is the third that needs the class machinery, which is a program
defining one of its own and adding attributes and methods to it.
So a class is a Kind, which is a closed set of exactly the classes
CPython has builtin, and the hierarchy between them is Kind::base. That
is what lets except ArithmeticError catch a ZeroDivisionError without
anything that could be called an object model existing yet.
Error is what the runtime returns rather than what a program holds. It
is a kind and a message because most of the time that is all there is: an
operator that was handed the wrong type raises out of Rust and no Python
object ever exists. When a program raises one itself the instance it raised
comes along in Error::value, so that the object it raised is the object
it will eventually catch.
Structs§
- Error
- A raised exception, on its way out of the runtime.
Enums§
- Kind
- Which exception it is, which is to say which class it is an instance of.
Type Aliases§
- Result
- What every operation in the runtime gives back.