Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/359.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
IPython中的类实现是否相对于Python进行了修改?_Python_Ipython - Fatal编程技术网

IPython中的类实现是否相对于Python进行了修改?

IPython中的类实现是否相对于Python进行了修改?,python,ipython,Python,Ipython,我试着比较Python和IPython中的\uuuu class\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu函数和类型()函数,并想知道下面的行为差异是否是因为IPython w 蟒蛇 >>> [].__class__ <class 'list'> >>> type([]) <class 'list'> 但对于print,它似

我试着比较Python和IPython中的
\uuuu class\uuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuuu
函数和
类型()
函数,并想知道下面的行为差异是否是因为IPython w

蟒蛇

>>> [].__class__
<class 'list'>
>>> type([])
<class 'list'>
但对于print,它似乎仍然是指Python的
\uuuuu类

蟒蛇

>>> print(type([]))
<class 'list'>
打印(类型([])) 伊皮顿

In [2]: [].__class__
Out[2]: list

In [3]: type([])
Out[3]: list
In [4]: print(type([]))
<class 'list'>
[4]中的
:打印(键入([]))

这就是神奇发生的地方:

In [1] import sys
In [2] sys.displayhook
Out[2]: <IPython.terminal.prompts.RichPromptDisplayHook at 0x7f6c42b08190>
[1]导入系统中的

在[2]sys.displayhook中
出[2]:
vs

导入系统 >>>sys.displayhook
正在显示的对象(
列表
,或
)是同一个对象。使用,IPython修改它在交互回复中的显示方式。

我猜是IPython的
sys.displayhook
被修改了:
列表仍然指
,只是打印方式不同而已。
>>> import sys
>>> sys.displayhook
<built-in function displayhook>