__LINE__ and __FILE__ functionality in Python?

Joakim Hove hove at ntnu.no
Sun Aug 13 08:19:26 EDT 2006


Maric Michaud <maric at aristote.info> writes:


> Sure, try :
>
> In [46]: import inspect
>
> In [47]: c=inspect.currentframe()
>
> In [48]: c.f_lineno
> Out[48]: 1
>
> In [49]: c.f_code.co_filename
> Out[49]: '<ipython console>'

Thanks a lot - that was just what I wanted.


Regards - Joakim


-- 
Joakim Hove
hove AT ntnu.no                    /    
Tlf: +47 (73 5)9 34 27            /     Stabburveien 18		 
Fax: .................           /      N-5231 Paradis		 
http://www.ift.uib.no/~hove/    /      	55 91 28 18 / 92 68 57 04



More information about the Python-list mailing list