Tuesday, October 29, 2013

missing the __line__ macro from C?

Frame objects to the rescue!

import sys

def __line__():
    f = sys._getframe().f_back
    return f.f_lineno + f.f_code.co_firstlineno

No comments:

Post a Comment