If I create a short function at the >>> prompt, can I save it and then re-edit it in the Python Shell? I know how to create and save it outside the Shell but am unfamiliar with the Shell command available to do this. Thanks, Dan
If I create a short function at the >>> prompt, can I save it and then re-edit it in the Python Shell? I know how to create and save it outside the Shell but am unfamiliar with the Shell command available to do this. Thanks, Dan
There's no way to do that in the standard Python shell (the one with the >>>
prompt). IPython consoles can save code, though -- it has various "magic" functions, one of which is %save
, which does what you want -- see this help page.
Thanks, Giles! Are you saying that seasoned Python coders prefer IPython to the basic Python Shell? Is there any downside to switching to IPython?
Thanks again, Dan
The IPython shell is more powerful than the standard Python REPL, but it's the same Python underneath. Whether you use it or not, is entirely up to your preference.
Thanks, Giles - looks like there's no reason not to use it (though I wonder why Python doesn't replace their vanilla IDLE with it), so I'll go for it.
Dan
Yup, agreed -- there's no reason not to use it :-)
Giles,
Just installed Ipython. Now off to find a good web-based tutorial on how to use it.
Thanks! Dan