FINANCIAL MODELLING PACKAGE IN PYTHON?

Randall Hopper aa8vb at yahoo.com
Wed Jan 5 09:18:21 EST 2000


Robin Becker:
 |Randall Hopper:
 |>Robin Becker:
 |> |how arithmetic errors are handled using built in IEEE exceptions and
 |> |how does one gracefully crash a python script? (eg an abend/abort).
 |>
 |>raise ArithmeticError, "Oops"
 |>raise ZeroDivisionError, "Ouch"
 |>
 |>?
 |>
 |yes that's python, but what's the best way to do it in an existing C
 |library?

And in the function that returns control to Python, do this:

    PyErr_Format( PyExc_ArithmeticError, "Oops\n" );
    return NULL;

The first statement can be invoked elsewhere if desired.

-- 
Randall Hopper
aa8vb at yahoo.com




More information about the Python-list mailing list