FINANCIAL MODELLING PACKAGE IN PYTHON?

Gordon McMillan gmcm at hypernet.com
Wed Jan 5 09:19:25 EST 2000


Robin Becker wrote:
 > > |Also under
> certain extreme circumstances my code would like to report a >
> |total failure eg attempt to divide by error. I would like to ask
> more > |experienced pythoneers 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? -- Robin Becker

PyErr_SetString(PyExc_ZeroDivisionError, "Ouch");
return NULL;

(see bltinmodule.c for the complete list).
 
> -- 
> http://www.python.org/mailman/listinfo/python-list



- Gordon




More information about the Python-list mailing list