Python equivalent of __LINE__ macro?
Edward C. Jones
edcjones at erols.com
Mon Jan 7 17:33:25 EST 2002
David Brady wrote:
> Is there an easy way to do this? The handiest thing
> would be to have a variable like __LINE__ hanging
> around, but in a pinch I suppose we could just use the
> traceback and trap all exceptions.... Though I wonder
> if there isn't an easier way.
If you just want to know the line number, try:
For details see section 3.11.2 of the Python Library Reference.
More information about the Python-list