具体的对象层

本章中的函数特定于某些 Python 对象类型。 将错误类型的对象传递给它们并不是一个好主意;如果您从 Python 程序接收到一个对象,但不确定它是否具有正确的类型,则必须首先执行类型检查;例如,要检查对象是否为字典,请使用 PyDict_Check()。 本章的结构类似于 Python 对象类型的“家族树”。

警告

While the functions described in this chapter carefully check the type of the objects which are passed in, many of them do not check for NULL being passed instead of a valid object. Allowing NULL to be passed in can cause memory access violations and immediate termination of the interpreter.

基本对象

本节描述Python类型对象和单一实例对象 象None。

Mapping Objects