[Python-Dev] SET_LINENO and python options

Skip Montanaro skip@mojam.com (Skip Montanaro)
Mon, 31 Jul 2000 17:07:02 -0500 (CDT)


    amk> It always seemed odd to me that the current line number is always
    amk> kept up to date, even though 99.999% of the time, no one will care.
    amk> Why not just keep a small table that holds the offset in the
    amk> bytecode at which each line starts, and look it up when it's
    amk> needed?

(I'm probably going to wind up seeming like a fool, responding late to this
thread without having read it end-to-end, but...)

Isn't that what the code object's co_lnotab is for?  I thought the idea was
to dispense with SET_LINENO altogether and just compute line numbers using
co_lnotab on those rare occasions (debugging, tracebacks, etc) when you
needed them.

Skip