reload and work flow suggestions
rusi
rustompmody at gmail.com
Sun Sep 22 09:44:34 EDT 2013
On Sunday, September 22, 2013 3:13:13 AM UTC+5:30, Peter Cacioppi wrote:
> This is an idea brought over from another post.
>
> When I write Python code I generally have 2 or 3 windows open simultaneously.
>
>
> 1) An editor for the actual code.
> 2) The interactive interpreter.
> 3) An editor for the unit tests. (Sometimes skipped for quick one-off scripts)
>
> My work flow tends to involve using 2 to debug the issues that come up with 1 and 3. I'll write some new code in 1, play around with it in 2, then solidify the tests in 3. Or a test in 3 fails and I dig around with it using 2.
>
>
>
> My problem is that I tend to use reload() quite a bit. I want to call
> functions and construct objects that are inside the guts of 1 and pass them
> arguments that are stored as variables in 2. If I restart my session for 2 I
> lose these variables (iPython does mitigate the pain here somewhat). Hence, I
> reload() modules into 2 when they are changed.
I (tend to) use emacs.
Now before this becomes an editor-war, I need to say that its hardly a question of editor and mostly a question of workflow. For example I know some core emacs devs who use vi-mode in emacs and as the joke goes:
Emacs is an excellent operating system; it only lacks a good editor.
About workflow: Its important to get that
1. editor-inside-interpreter -- eg !vi in ipython
2. interpreter-and-editor side-by-side -- your workflow
3. interpreter-inside-editor -- natural for emacs and IDLE (I think)
are significantly different
And one important difference is that for 3. the burden of reload goes from python to the editor -- one hotkey and the buffer is reloaded into the interpreter.
More information about the Python-list
mailing list