В настоящее время я использую NetBeans IDE с Jython 2.5.1
При пошаговой отладке моего проекта, как только встречается итерация над генератором, отладчик сразу переходит в конец кода. Вывод работает нормально, но невозможно выполнить пошаговую отладку, как только встречается первый генератор.
Является ли такое поведение стандартным для отладки Python во всех Python IDE? Разве нельзя отлаживать код "yield after yield" так же, как мы можем отлаживать VBA для каждого элемента цикла "for" (извините за упоминание VBA :))?
Спасибо.
EDIT
Без генератора
Код:
def example(n):
i = 1
while i <= n:
yield i
i += 1
print "hello"
print "goodbye"
Выход:
hello
goodbye
Отладка:
[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
С генератором
Код:
def example(n):
i = 1
while i <= n:
yield i
i += 1
print "hello"
for n in example(3):
print n
print "goodbye"
Выход:
hello
1
2
3
goodbye
Отладка:
[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