Low-Level Functions on Built-in Types

The functions in Tables B.9 through B.21 can be used to manipulate various 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 >_From<type > are used to create a Python object from a C datatype. Functions of the form Py<type >_As<type > are used to convert from Python to C. These functions are presented without further description.

Table B.9. Integers
Type Function
long PyInt_AsLong(PyObject *iobj )
int PyInt_Check(PyObject *obj )
PyObject * PyInt_FromLong(long)
long PyInt_GetMax(void)
Table B.10. Long Integers
Type Function
double PyLong_AsDouble(PyObject *lobj )
long PyLong_AsLong(PyObject ...

Get Python Essential Reference, Second Edition now with O’Reilly online learning.

O’Reilly members experience live online training, plus books, videos, and digital content from 200+ publishers.