Sta*_*tch 7 python debugging generator
我目前正在使用带有Jython 2.5.1的NetBeans IDE
在逐步调试项目时,只要遇到生成器的迭代,调试器就会直接进入代码的末尾.输出工作正常,但是一旦满足第一个发生器就不可能一步一步地进行调试.
这是所有Python IDE中Python调试的标准行为吗?是不是可以调试代码"yield after yield",就像我们可以为"for"循环的每个元素调试VBA一样(抱歉提到VBA :)?
谢谢.
编辑
没有发电机
码:
def example(n):
i = 1
while i <= n:
yield i
i += 1
print "hello"
print "goodbye"
Run Code Online (Sandbox Code Playgroud)
输出:
hello
goodbye
Run Code Online (Sandbox Code Playgroud)
调试:
[LOG]PythonDebugger : overall Starting
[LOG]PythonDebugger.taskStarted : I am Starting a new Debugging Session ...
[LOG]This window is an interactive debugging context aware Python Shell
[LOG]where you can enter python console commands while debugging
(...)
>>>[stdout:]hello
>>>[stdout:]goodbye
Debug session normal end
Run Code Online (Sandbox Code Playgroud)
随着发电机
码:
def example(n):
i = 1
while i <= n:
yield i
i += 1
print "hello"
for n in example(3):
print n
print "goodbye"
Run Code Online (Sandbox Code Playgroud)
输出:
hello
1
2
3
goodbye
Run Code Online (Sandbox Code Playgroud)
调试:
[LOG]PythonDebugger : overall Starting
[LOG]PythonDebugger.taskStarted : I am Starting a new Debugging Session ...
[LOG]This window is an interactive debugging context aware Python Shell
[LOG]where you can enter python console commands while debugging
(...)
>>>[stdout:]hello
>>>None['GeneratorExit
deamon ended
']
Debug session normal end
Run Code Online (Sandbox Code Playgroud)
| 归档时间: |
|
| 查看次数: |
1980 次 |
| 最近记录: |