
Years ago I worked for a while in REXX. It was a fairly advanced scripting language for its time and we used it on some substantial mainframe projects. One thing that I liked and miss in Python is the "trace" statement. Basically, you could insert a "trace" statement in a REXX program and then, when you ran it, it would step through the program a line at a time. This gave you the chance to follow your code through tricky sections and display variables after each step. I know it saved me hours of troubleshooting of tricky problems. I would like to know if anyone has ever proposed something similar for Python. It would work something like this: 1. In an interactive session, you could issue a trace command. Thereafter, whatever you ran would be done a step at a time, with a terminal prompt after every statement for you to print anything you like that would help you understand the state of the program at that point. 2. From the command line, you could add a --trace option, or something like it, to ask Python to launch the program interactively with trace enabled, which would work as described above. 3. If you have a problematic piece of code, you could insert a trace statement just before the troubled section. Then when you ran the program, when it came to the trace statement, it would begin an interactive trace at that point as described above. (You would have to start your program from the command line for this to make sense.) Has something like this ever come up before? Is there a way to do this today? -- Gerald Britton

Jacob Holm <jh@improva.dk> wrote:
I just learned about this one, which is also sometimes useful (when you _don't_ want the interactive prompt, you just want to see the sequence of execution): python -m trace -t <pythonprogram> -- R. David Murray http://www.bitdance.com

Thanks for the tip! btw, did you get the --ignore-dir option to work? I'm trying to run this on a large system (hundreds of modules) and ignore most of the modules and packages to focus on just a few. However, it processes all of them anyway On Fri, Mar 20, 2009 at 1:02 PM, R. David Murray <rdmurray@bitdance.com> wrote:
-- Gerald Britton

On Fri, 20 Mar 2009 at 13:53, Gerald Britton wrote:
[top posting fixed for clarity] Haven't tried that option, I've only used it for small programs so far. -- R. David Murray http://www.bitdance.com

Jacob Holm <jh@improva.dk> wrote:
I just learned about this one, which is also sometimes useful (when you _don't_ want the interactive prompt, you just want to see the sequence of execution): python -m trace -t <pythonprogram> -- R. David Murray http://www.bitdance.com

Thanks for the tip! btw, did you get the --ignore-dir option to work? I'm trying to run this on a large system (hundreds of modules) and ignore most of the modules and packages to focus on just a few. However, it processes all of them anyway On Fri, Mar 20, 2009 at 1:02 PM, R. David Murray <rdmurray@bitdance.com> wrote:
-- Gerald Britton

On Fri, 20 Mar 2009 at 13:53, Gerald Britton wrote:
[top posting fixed for clarity] Haven't tried that option, I've only used it for small programs so far. -- R. David Murray http://www.bitdance.com
participants (3)
-
Gerald Britton
-
Jacob Holm
-
R. David Murray