[IPython-user] changed %edit magic command to re-edit previous user cmd if no arg specified
Fernando.Perez at colorado.edu
Mon May 30 02:11:18 CDT 2005
Tom Popovich wrote:
> Proposed changing %edit magic command to re-edit previous user cmd if
> no arg specified
sorry, but this can't be done, as it would break backwards compatiblity:
currently a plain %edit opens up a new file, and your patch would
provide no way to do so.
> Here are the changes:
note that your patch also modifies the semantics of '%edit NN', where NN
is a number, to recursively try backwards all input line numbers,
skipping lines which are magic commands. I'm not sure what the need for
Remember that with readline, a simple ed<UPARROW> already gives you back
the last input line matching edits, and it's really not that hard to
save your input to a named file if you are really going to be working on
it a lot.
So far I fail to really see the need for this added complexity,
especially since your patch actually modifies other aspects of %edit
which I can't change.
If you really feel that there is a glaring limitation in how %edit works
today, please outline why that is the case (and why the existing
mechanisms aren't enough to address what you need). And in that case,
please send a patch (against CVS) which only addresses that. The
changes above which break existing behavior in an incompatible way cant'
As I mentioned before, I'm happy to see improvements from users, but we
also need to balance new functionality with the cost it brings in
increased code maintenance and usage complexity. Too many features
sometimes are not necessarily a good thing: a good design should provide
enough features to do what users need, but not each task in 10 subtly
different ways :)
Finally note that if you _really_ want to have a highly personalized
version of %edit, nothing stops you from doing so. The manual shows how
to have your own magic functions, so feel free to have one (you can even
name it %edit and override the default one) which behaves exactly the
way you want it. That's the whole point of making ipython highly
customizable: users don't have to live with my decisions if they don't
like them :) But for the same reason, the default system should
maintain a certain level of simplicity, leaving it to power users to
customize their setup any way they like it.
More information about the IPython-user