O'Reilly logo

Python Essential Reference, Second Edition by David M 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 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 ...

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