IPython,禁止输出的分号不起作用 [英] IPython, semicolon to suppress output does not work

查看:45
本文介绍了IPython,禁止输出的分号不起作用的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

http://ipython.org/ipython-doc/上的文档中dev/interactive/tips.html 表示在命令末尾添加分号(;)以禁止其输出.就我而言,这似乎不起作用,即使是

In the documentation at http://ipython.org/ipython-doc/dev/interactive/tips.html it says to put a semicolon (;) at the end of a command to suppress its output. This does not seem to work in my case as even a

>>> \>>> print('Hello');  
--> 'Hello'

我是否对输出抑制有错误的想法,或者这是一个错误?在pudb中工作时,这尤其令人讨厌,因为按我的情况,当我按"next"或"step into"时,它会可怕地闪烁.

Do I have the wrong idea of output suppression or is this a bug? This is especially annoying when working in pudb, as it flashes horribly in my case as I press 'next' or 'step into'.

P.S输出既不在我的ubuntu ipython 0.10上也不在osx lion ipython 0.11上被抑制.尽管osx中的闪烁问题更严重,可能是由于item2.

P.S the output is neither on my ubuntu ipython 0.10 nor osx lion ipython 0.11 supressed. Although the flashing issue is worse in osx, probably because of item2.

推荐答案

尝试类似1 + 1;的方法.如果没有分号,它应该通过打印输出给您有关结果的反馈(格式为repr,尽管对于整数,这并不重要)-我认为应该抑制此输出. Shell不会(也不应)禁止写入恰好被sys.stdout引用的文件(这实际上是print所做的事情).这是完全不同的事情,而不是外壳的工作.

Try something like 1 + 1;. Without the semicolon, it should give you feedback about the result by printing it (formatted by repr, though it doesn't matter in the case of integers) - I assume that it's this output that's supposed to be suppressed. The shell doesn't (and shouldn't) suppress writing to the file that happens to be referenced by sys.stdout (which is essentially what print does). This is an entirely different matter, and not the job of the shell.

这篇关于IPython,禁止输出的分号不起作用的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆