![]() |
|
|
+ Search |
![]()
|
Jul 5th, 2000 10:02
Nathan Wallace, Hans Nowak, Snippet 267, Adrian Eyre
"""
Packages: miscellaneous.introspection
"""
"""
> Is there an equivalent of the C __LINE__ macro in Python to get the
> currentline number?
"""
import sys
def what_line_am_i_on():
try:
raise "Hack"
except:
return sys.exc_info()[2].tb_frame.f_back.f_lineno
print "This is line " + str(what_line_am_i_on())