exceptions, internals (introspection?)

Fernando Perez fperez.net at gmail.com
Fri Nov 11 06:17:35 CET 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.  I browsed through the table of contents of both the
> Library Reference & Language Reference. I see section 18. Python Language
> Services.  In browsing through that, I'm thinking "Oh man... this is way
> more than I need - there's got to be an easier way."   Nothing else is
> jumping out at me. Can someone point me to some documentation on this
> subject and/or provide some examples?

Poke around IPython, which implements a pretty massive amount of functionality
in this direction.  In particular, you want to read OInspect.py and ultraTB.py.

Cheers,

f




More information about the Python-list mailing list