Concrete Objects Layer¶
The functions in this chapter are specific to certain Python object types.
Passing them an object of the wrong type is not a good idea; if you receive an
object from a Python program and you are not sure that it has the right type,
you must perform a type check first; for example, to check that an object is a
dictionary, use PyDict_Check()
. The chapter is structured like the
"family tree" of Python object types.
警告
虽然本章所描述的函数会仔细检查传入对象的类型,但是其中许多函数不会检查传入的对象是否为 NULL
。 允许传入 NULL
可能导致内存访问冲突和解释器的立即终止。
Fundamental Objects¶
This section describes Python type objects and the singleton object None
.
Numeric Objects¶
Sequence Objects¶
Generic operations on sequence objects were discussed in the previous chapter; this section deals with the specific kinds of sequence objects that are intrinsic to the Python language.