O'Reilly logo

Python: Essential Reference, Third Edition by David Beazley

Stay ahead with the world's most comprehensive technology and business learning platform.

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, tutorials, and more.

Start Free Trial

No credit card required

Low-level Functions on Built-in Types

The functions in Tables 27.10 through 27.22 can be used to manipulate specific built-in types. Functions of the form Py<type>_Check() are used to check the type of an object and return 1 if an object is the correct type, 0 otherwise. Functions of the form Py<type>_CheckExact() perform the same task, but make sure that the object is exactly the appropriate type—not a type that has been derived via inheritance. Functions of the form Py<type>_From<type> are used to create a Python object from a C data type. Functions of the form Py<type>_As<type> are used to convert from Python to C.

Table 27.10. Integers
TypeFunction
longPyInt_AsLong(PyObject *iobj);
intPyInt_Check(PyObject *obj)
intPyInt_CheckExact(PyObject

With Safari, you learn the way you learn best. Get unlimited access to videos, live online training, learning paths, books, interactive tutorials, and more.

Start Free Trial

No credit card required