From https://docs.python.org/3/library/exceptions.html#SystemExit Also, this exception derives directly from BaseException and not Exception, since it is not technically an error. and The exception inherits from BaseException instead of Exception so that it is not accidentally caught by code that catches Exception. This allows the exception to properly propagate up and cause the interpreter to exit. Here is a patch to remove the duplicate content and document the code attribute properly.
The new text changes “the associated value” to “the value passed to [the] :func:`sys.exit` call”. There seems to be a trend in removing documentation of exception constructor arguments; is this intentional? In my code I tend to raise SystemExit() directly rather than importing the “sys” module and calling sys.exit().
How about this: ''' The constructor accepts the same optional argument passed to :func:`sys.exit`. If the value is an integer, it specifies the system exit status . . . . . . .. attribute:: code The exit status or error message that is passed to the constructor. (Defaults to ``None``.) '''