I'm facing a very strange issue on Python 3.6. In the middle of my code, I call import pdb; pdb.set_trace()
to debug some code.
And then I'm not able to debug properly, for instance:
(Pdb) abc = 3
(Pdb) [abc for _ in range(2)]
*** NameError: name 'abc' is not defined
(Pdb) [abc, abc]
[3, 3]
It seems like whenever I use list comprehensions, there is an issue of variable not defined. However, if I call the debugger right after I open Python, I do not observe this behavior, everything runs fine.
Any ideas why I'm having this issue?
See Question&Answers more detail:
os 与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…