exceptions, internals (introspection?)

Paul McNett p at ulmcnett.com
Thu Nov 10 16:06:11 EST 2005


ej wrote:
>     I have often wondered how to get at other internals, such as the name of
> the current function, file, line number I am in?  The arguments to the
> current function, etc. 

Others have given you information on how to get at the stack trace. But 
regarding getting at some of the other internals you are talking about:

 >>> import inspect
 >>> help(inspect)

Back to exceptions, you can also provide your own global exception handler by 
overriding sys.excepthook (drop in your own function).

-- 
Paul McNett
http://paulmcnett.com
http://dabodev.com




More information about the Python-list mailing list