[Python-Dev] SET_LINENO and python options

Ka-Ping Yee ping@lfw.org
Sun, 30 Jul 2000 23:47:59 -0700 (PDT)

On Sat, 29 Jul 2000, Ken Manheimer wrote:
> On Fri, 28 Jul 2000 Vladimir.Marangozov@inrialpes.fr wrote:
> > 1) python         - code without SET_LINENO
> > 2) python -g      - code for debugging, with SET_LINENO
> > 3) python -O      - code without doc-strings.
> I would be firmly -1 on this proposal.

Funny -- i was just about to throw in a hearty +1.

> I see the ability to debug at whim, even when you didn't expect having to
> do so, as being a major win, part of the incremental development process.  

But you *can't* debug at whim, right?  You have to have started the
debugger, so it can hook sys.settrace, before you run your program.
If you have to start the debugger anyway, then you can surely say -g.

If you *didn't* start the debugger beforehand, the best you can get
is a detailed traceback with function names and line numbers -- and
you don't lose any of that when SET_LINENO goes away.

Let's suppose:

    1.  -g is turned on by default in interactive mode, since we
        don't know if you're going to feel like tracing today.

    2.  Programs (like debuggers and IDEs) that know they're going
        to use sys.settrace, or which contain embedded interactive
        interpreters, begin with 
            #!/usr/bin/env python -g

    3.  Other programs begin with the usual

            #!/usr/bin/env python

Given this -- are there any debugging opportunities you're missing
out on?  I don't see any...

-- ?!ng