Ever use iPython and write a large function inline only to discover that you made a typo somewhere? But then what if you need a newline in that block? You could just hit up to reproduce the same code and then try and hack in the missing code you wanted with "and"... eh...
No more! After realizing your mistake, type:
where NN is the number of the output prompt that you'd like to edit, then use a regular text editor to fix your inline function.
Here's an example:
In : def foo():
In : %edit 19
IPython will make a temporary file named: /var/folders/2b/2tts4sd7lfnf94dwg1fmnw0000gn/T/ipythonedit2VAfeC.py
Editing... done. Executing edited code...
Out: 'def foo():\n print "baz"\n \n'
In : foo()
What I did there was define a function called foo() that printed out "bar", then decided that what I really wanted foo() to do was to print out "baz", so I edited it with vi and then saved and quit, which led to my changes being applied, as demonstrated.
Or if you don't believe me, read the docs: