在ipython中模拟dreampie

时间:2014-01-30 10:04:16

标签: python ipython

Dreampie是另一种Python shell,就像IPython一样。

其主要卖点是界面,分为历史记录框代码框。您键入代码框,并且您的代码不会与先前命令的输出混淆。

不幸的是,它不是CLI应用程序,而且通过SSH使用起来更加困难。此外,IPython嵌入功能要优越得多。

是否可以使用IPython模拟此行为?

2 个答案:

答案 0 :(得分:1)

如前所述,您可以使用格栅IPython笔记本。

在常规CLI ipython中,你无法拆分屏幕,但你可以使用%edit magic来输入多行文字,或编辑预览行,

 In [2]: %edit #VIM, or other editor, opens and let you edit your code. 
 IPython will make a temporary file named: /tmp/ipython_edit_GHc1Wg.py
 Editing... done. Executing edited code...
 Out[2]: 'def hello():\n    print "hello world"\n' #This is the code I entered in VIM

 In [3]: hello()
 hello world

 In [4]: %edit _2  #I repoened VIM and ask it to reedit the stuff in the ouput of line [2]
 IPython will make a temporary file named: /tmp/ipython_edit_k7l0Wc.py
 Editing... done. Executing edited code...
 Out[4]: 'def hello():\n    print "godbye world"\n'

 In [5]: hello()
 godbye world

另一种选择是使用 VIM-Ipython https://github.com/ivanov/vim-ipython),您可以在其中键入VIM中的文本,选择部分代码并在VIM内的IPython-shell窗口中执行。

答案 1 :(得分:0)

ipython笔记本允许您在块中编写代码,就像Dreampie一样,只在代码准备就绪时才执行代码。您还可以返回并编辑以前的命令等,以及嵌入matplotlib图。在http://ipython.org/notebook.html有一个视频演示。

您可以通过打开本地隧道(http://wisdomthroughknowledge.blogspot.co.uk/2012/07/accessing-ipython-notebook-remotely.html)在SSH上使用它们。它是否足够快取决于你的连接。

笔记本电脑真正从ipython 1.0版本开始。