Python equivalent of #line?

Andrew Dalke adalke at mindspring.com
Tue May 27 15:21:56 EDT 2003


Russ Salsbury:
> +1 for #line
>
> Very few people have a need for it, but those of us who write
> application generators appreciate it very much.

Well, I did this by setting a Python variable, 'lineno', in the
generated code, then putting a try/except around the whole
thing so I could get the lineno for reporting.

Also used this trick when parsing input files.

                    Andrew
                    dalke at dalkescientific.com






More information about the Python-list mailing list