本文整理匯總了Python中IPython.Shell.IPShellEmbed.set_dummy_mode方法的典型用法代碼示例。如果您正苦於以下問題:Python IPShellEmbed.set_dummy_mode方法的具體用法?Python IPShellEmbed.set_dummy_mode怎麽用?Python IPShellEmbed.set_dummy_mode使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類IPython.Shell.IPShellEmbed
的用法示例。
在下文中一共展示了IPShellEmbed.set_dummy_mode方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Python代碼示例。
示例1: ipshell
# 需要導入模塊: from IPython.Shell import IPShellEmbed [as 別名]
# 或者: from IPython.Shell.IPShellEmbed import set_dummy_mode [as 別名]
ipshell('***In foo(). Try @whos, or print s or m:')
print 'foo says m = ',m
def bar(n):
s = 'eggs'
ipshell('***In bar(). Try @whos, or print s or n:')
print 'bar says n = ',n
# Some calls to the above functions which will trigger IPython:
print 'Main program calling foo("eggs")\n'
foo('eggs')
# The shell can be put in 'dummy' mode where calls to it silently return. This
# allows you, for example, to globally turn off debugging for a program with a
# single call.
ipshell.set_dummy_mode(1)
print '\nTrying to call IPython which is now "dummy":'
ipshell()
print 'Nothing happened...'
# The global 'dummy' mode can still be overridden for a single call
print '\nOverriding dummy mode manually:'
ipshell(dummy=0)
# Reactivate the IPython shell
ipshell.set_dummy_mode(0)
print 'You can even have multiple embedded instances:'
ipshell2()
print '\nMain program calling bar("spam")\n'
bar('spam')