Is there something similar to `set -v` of bash in python

Peng Yu pengyu.ut at gmail.com
Sat Sep 17 23:08:41 EDT 2016


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?

On Sat, Sep 17, 2016 at 5:28 PM, Ned Batchelder <ned at nedbatchelder.com> wrote:
> On Saturday, September 17, 2016 at 4:41:32 PM UTC-4, Peng Yu wrote:
>> >     python -m trace -t yourprogram.py
>>
>> If I want to add some command in yourprogram.py to show the commands
>> used it instead of calling trace from the command line, can it be
>> done?
>
> I don't know of a way to do that, but it might be possible.
>
> --Ned.
> --
> https://mail.python.org/mailman/listinfo/python-list



-- 
Regards,
Peng



More information about the Python-list mailing list