On Saturday, September 17, 2016 at 11:09:04 PM UTC-4, Peng Yu wrote: > The manual says the following. > > "The trace function is invoked (with event set to 'call') whenever a > new local scope is entered; it should return a reference to a local > trace function to be used that scope, or None if the scope shouldn’t > be traced." > > It means that one can not somehow settrace in one line and expect to > get the trace function being called in the next line. > > So something like `set -v` in bash sounds not possible. Is it so?
You've found a good reason why "set -v" would be very difficult if not impossible in Python. I'm curious though, why you would want to trace every line in a program every time you (or anyone else) ran it? I view tracing lines as a debugging technique. Once the program is behaving properly, why do you want all the noise of the traced lines? In Bash scripts we do it because some scripts are light automation where the person running the script should have a clear idea of what actions it is taking. The actions in the script are commands that the person might run themselves at other times, and so the difference between running the script and running the commands is not great. But in a Python program, presumably the difference is greater. I cannot type out single Python lines at my shell prompt to perform the actions the Python program does. Perhaps you want to define an alias for "python -m trace -t $*" ? --Ned. -- https://mail.python.org/mailman/listinfo/python-list