简体   繁体   中英

Python Debugging: code editing on the fly

I am new to python and haven't been able to find out whether this is possible or not.

I am using the PyDev plugin under Eclipse, and basically all I want to find out is, is it possible to edit code whilst you're sitting at a breakpoint? Ie Edit code whilst you're debugging.

It allows me to do this at present, but it seems to still be executing the line of code that previously existed before I made changes.

Also, are you able to drag program execution back like you can in VBA and C# for example?

If either of these are possible, how can I enable them?

PyDev 从 1.4.8 版开始在一定程度上支持这一点,请参阅更改说明和相应的博客条目

When you start a Python program, it will be compiled into bytecode (and possibly saved as .pyc file). That means you can change the source but since you don't "open" the source again, the change won't be picked up.

There are systems like TurboGears (a web framework) which detect these changes and restart themselves but that's probably going to confuse the debugger.

Going back in time also isn't possible currently since the bytecode interpreter would need support for this.

You can run arbitrary commands in the console during the breakpoint. For my needs, this typically achieves the same purpose as coding live, although I do wish it were as elegant as simply using the editor.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM