6

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? I.e. 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?

3 Answers 3

4

PyDev supports this to some extend since version 1.4.8, see the change notes and the corresponding blog entry.

Sign up to request clarification or add additional context in comments.

1 Comment

I don't see the references you are talking about. Can you point to them more specifically? Sounds exciting; I hadn't even been aware of the new version of PyDev until your answer drew my attention to it, so thanks. :-)
2

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.

1 Comment

It's true that you can't go back in time, and also that the debugger is single-threaded and can't withstand a restart, but your headline, "this is not possible with Python right now" is inaccurate, as @nikow points out.
2

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.

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.