Yurttas/PL/SL/python/docs/core-python-programming/doc/16/api/intObjects.html

From ZCubes Wiki
Revision as of 18:54, 7 November 2013 by MassBot1 (talk | contribs) (Created page with "<div class="navigation"> {| width="100%" cellspacing="2" align="center" | yurttas/PL/SL/python/docs/core-python-programming/doc/16/api/longObjects.html|[[Image:yurttas_...")
(diff) ← Older revision | Latest revision (diff) | Newer revision → (diff)
Jump to navigation Jump to search


7.4.1 Plain Integer Objects

PyIntObject
This subtype of PyObject represents a Python integer object.
PyTypeObject PyInt_Type
This instance of PyTypeObject represents the Python plain integer type. This is the same object as types.IntType.
int PyInt_Check (PyObject* o)
Return value: Borrowed reference.
Returns true if o is of type PyInt_Type.
PyObject* PyInt_FromLong (long ival)
Return value: New reference.
Creates a new integer object with a value of ival. The current implementation keeps an array of integer objects for all integers between -1 and 100, when you create an int in that range you actually just get back a reference to the existing object. So it should be possible to change the value of 1. I suspect the behaviour of Python in this case is undefined. :-)
long PyInt_AsLong (PyObject *io)
Will first attempt to cast the object to a PyIntObject, if it is not already one, and then return its value.
long PyInt_AS_LONG (PyObject *io)
Returns the value of the object io. No error checking is performed.
long PyInt_GetMax ()
Returns the system's idea of the largest integer it can handle (LONG_MAX, as defined in the system header files).