MarkHammerНашел ответ сам - последовательности команд можно легко вводить в ipython при помощи функции %edit
Еще вопрос - в ipython ввел цикл - он выполнился с ошибкой - есть ли возможность скопировать его целиком и ввести - или надо заново вводить построчно ?
вот пример из мануала:
This is an example of creating a simple function inside the editor and
then modifying it. First, start up the editor:
In : ed
Editing… done. Executing edited code…
Out: ‘def foo():n print “foo() was defined in an editing session”n’
We can then call the function foo():
In : foo()
foo() was defined in an editing session
Now we edit foo. IPython automatically loads the editor with the
(temporary) file where foo() was previously defined:
In : ed foo
Editing… done. Executing edited code…
And if we call foo() again we get the modified version:
In : foo()
foo() has now been changed!
Here is an example of how to edit a code snippet successive
times. First we call the editor:
In : ed
Editing… done. Executing edited code…
hello
Out: “print ‘hello’n”
Now we call it again with the previous output (stored in _):
In : ed _
Editing… done. Executing edited code…
hello world
Out: “print ‘hello world’n”
Now we call it with the output #8 (stored in _8, also as Out):
In : ed _8
Editing… done. Executing edited code…
hello again
Out: “print ‘hello again’n”