从
Dive into Python开始:
Python has a function called info. Try it yourself and skim through
the list now.
>>> from apihelper import info
>>> import __builtin__
>>> info(__builtin__, 20)
ArithmeticError Base class for arithmetic errors.
AssertionError Assertion failed.
AttributeError Attribute not found.
EOFError Read beyond end of file.
EnvironmentError Base class for I/O related errors.
Exception Common base class for all exceptions.
FloatingPointError Floating point operation failed.
IOError I/O operation failed.
事实证明,Python没有名为info的函数.这本书指的是什么?
最佳答案 我不知道为什么Dive Into Python声称“Python有一个叫做info的函数”,但显然不是这样.
apihelper.py(从中导入信息)在本书in section 4.1的前面描述,它只是Mark Pilgrim编写的用于Dive Into Python的模块.该apihelper模块显然确实包含一个信息函数,该函数执行您链接的4.3.3节中声明的内容.