Interactive development in Python à la Smalltalk?
Terry Jan Reedy
tjreedy at udel.edu
Mon Apr 8 15:01:08 EDT 2013
On 4/8/2013 4:33 AM, Bienlein wrote:
> Hello,
>
> I'm absolutely new to Python, just looked at the language description
> for the first time. The first thought that came to my mind was
> whether you can program in Python in an interactive programming
> style, i.e. I can change code in the debugger which becomes
> immediately effective (no edit-compile loop) and I can also send
> messages to objects visible inside the debugger.
The CPython interpreter has both a 'batch' mode (run code in a file) and
an interactive mode (run code typed in response to a prompt). It also
has a '-i' option to run code in batch mode and then switch to
interactive mode so one can interrogate visible objects and call functions.
The Idle IDE has editor windows linked to an interactive shell. When you
run code in the editor window, it saves and runs it with the -i option
so you can interactive with the results in the Shell. Compiling edited
text to bytecode is typically so fast (well under a second) as to not be
an issue.
> Then Python could become my replacemenet for my dearly missed
> Smalltalk, which to my great grief meanwhile really has become quite
> dead, I fear. In Smalltalk you can open up an inspector window (e.g.
> you don't have to get into debug mode), inspect objects in it and
> evaluate code in it, send messaages to objects. I guess this cannot
> be done in Python out of the box. But if changes made in the debugger
> became immediately effective, this would be interactive enough for my
> purposes.
Idle also has a debugger window that does some of that, though it works
better on non-Windows OSes. I have never actually used it.
---
Terry Jan Reedy
More information about the Python-list
mailing list