Python equivalent of #line?

Anders J. Munch andersjm at dancontrol.dk
Mon May 26 05:17:45 EDT 2003


Greg Ewing wrote:
> 
> It would be nice to have a nicer way, though. Maybe
> something like
> 
> __line__ = <const>

Agreed.

For the next Capon version I'm doing this: Filenames and line numbers
are encoded in function names, and exceptions are intercepted and
patched.  This works well; the only drawback is that patched
tracebacks (presumably, haven't tried it) don't play well with pdb.

I'll see if I can factor this functionality out into a separate module
for reuse.

- Anders






More information about the Python-list mailing list