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

2016-09-18 Thread Ned Batchelder
On Sunday, September 18, 2016 at 8:29:38 AM UTC-4, Peng Yu wrote: > On Sunday, September 18, 2016, Ned Batchelder wrote: > > > 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 'c

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

2016-09-18 Thread Peng Yu
On Sunday, September 18, 2016, Ned Batchelder wrote: > 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

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

2016-09-18 Thread Ned Batchelder
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 th

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

2016-09-17 Thread Chris Angelico
On Sun, Sep 18, 2016 at 1:08 PM, 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 > b

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

2016-09-17 Thread Peng Yu
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 on

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

2016-09-17 Thread Ned Batchelder
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

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

2016-09-17 Thread Peng Yu
> 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? -- Regards, Peng -- https://mail.python.org/mailman/listinfo/python-list

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

2016-09-17 Thread Ned Batchelder
On Saturday, September 17, 2016 at 2:37:42 AM UTC-4, Steve D'Aprano wrote: > On Sat, 17 Sep 2016 12:31 pm, Peng Yu wrote: > > > Hi, `set -v` in bash allows the print of the command before print the > > output of the command. > > > > I want to do the similar thing --- print a python command and th

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

2016-09-17 Thread Thorsten Kampe
* Thorsten Kampe (Sat, 17 Sep 2016 12:25:05 +0200) > > * Peng Yu (Fri, 16 Sep 2016 21:31:37 -0500) > > > > Hi, `set -v` in bash allows the print of the command before print the > > output of the command. > > > > I want to do the similar thing --- print a python command and then > > print the out

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

2016-09-17 Thread Thorsten Kampe
* Peng Yu (Fri, 16 Sep 2016 21:31:37 -0500) > > Hi, `set -v` in bash allows the print of the command before print the > output of the command. > > I want to do the similar thing --- print a python command and then > print the output of the command. Is it possible with python? Rather easily. I've

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

2016-09-16 Thread Steve D'Aprano
On Sat, 17 Sep 2016 12:31 pm, Peng Yu wrote: > Hi, `set -v` in bash allows the print of the command before print the > output of the command. > > I want to do the similar thing --- print a python command and then > print the output of the command. Is it possible with python? There is no built-i