2014-01-30 23 views
1

Dreampie是一個可替代的Python shell,就像IPython一樣。在ipython中模擬dreampie

它的主要賣點是界面,拆分爲歷史框代碼框。你輸入代碼框,你的代碼不會與前面命令的輸出混淆。

不幸的是,它不是CLI應用程序,通過SSH使用起來更加困難。而且IPython的嵌入能力遠遠優越。

是否可以使用IPython來模擬此行爲?

回答

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版本進入自己的行列。

+0

筆記本不可嵌入,嵌入對我來說是一個「殺手功能」。不過,謝謝帕斯卡:) – gioi

1

如前所述,您可以使用爐排IPython筆記本。

在常規CLI IPython中,你不能分割屏幕,但你可以爲了進入多行文本,或編輯預覽行使用%編輯魔法,

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-Ipythonhttps://github.com/ivanov/vim-ipython)您可以在VIM中鍵入文本,選擇部分代碼並在VIM中的IPython-shell窗口中執行它。

+0

謝謝,Ronen。不幸的是,'%edit'不是一個選項,因爲我在輸入時看不到輸出。 – gioi