equivalent of bash "set -x" in Python

Chris Rebert clp2 at rebertia.com
Sun Sep 26 12:28:57 CEST 2010

On Sun, Sep 26, 2010 at 3:17 AM, TP <Tribulations at paralleles.invalid> wrote:
> Hi everybody,
> I am interested in having the possibility to print every Python commands in
> a script (for didactic purpose).
> So I am looking for some sort of equivalent of bash "set -x".
> Does it exist?

Not exactly. However, defining an appropriate function and passing it
to sys.settrace() would be the closest analogue:

You could also step through your code manually using the debugger:


More information about the Python-list mailing list