def raise_ ( exception = ABSENT , * args , * * kwargs ) : if exception is ABSENT : raise else : if inspect . isclass ( exception ) : raise exception ( * args , * * kwargs ) else : if args or kwargs : raise TypeError ( "can't pass arguments along with " "exception object to raise_()" ) raise exception
how to raise exponents in python
Raise ( or re - raises ) an exception .
def raise_(exception=ABSENT, *args, **kwargs):
    """Raise (or re-raises) an exception.

    :param exception: Exception object to raise, or an exception class.
                      In the latter case, remaining arguments are passed
                      to the exception's constructor.
                      If omitted, the currently handled exception is re-raised.
    """
    if exception is ABSENT:
        raise
    else:
        if inspect.isclass(exception):
            raise exception(*args, **kwargs)
        else:
            if args or kwargs:
                raise TypeError("can't pass arguments along with "
                                "exception object to raise_()")
            raise exception