Peng Yu wrote:
__LINE__ __FILE__ in C++ can give the current line number and
filename. Is there a similar thing in python that can give me the
current line number and filename?

Is there a similar thing to __PRETTY_FUNCTION__ (also from C++)?

mod.__name__ gives the module name, and mod.__file__ gives the full path to the given module. Or if you need those for the current module, just leave off the prefix.

For line number information, you probably can get it from the inspect module, but I don't have any direct experience. I do have the following untested line
in my notes:
          inspect.getframeinfo(inspect.currentframe()).function)

DaveA



--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to