<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.0 Transitional//EN">
<!--Converted with LaTeX2HTML 98.2 beta6 (August 14th, 1998)
original version by:  Nikos Drakos, CBLU, University of Leeds
* revised and updated by:  Marcus Hennecke, Ross Moore, Herb Swan
* with significant contributions from:
  Jens Lippmann, Marek Rouchal, Martin Wilck and others -->
<HTML>
<HEAD>
<TITLE>7.4.1 Plain Integer Objects </TITLE>
<META NAME="description" CONTENT="7.4.1 Plain Integer Objects ">
<META NAME="keywords" CONTENT="api">
<META NAME="resource-type" CONTENT="document">
<META NAME="distribution" CONTENT="global">
<META HTTP-EQUIV="Content-Type" CONTENT="text/html; charset=iso-8859-1">
<LINK REL="STYLESHEET" HREF="api.css">
<LINK REL="next" HREF="longObjects.html">
<LINK REL="previous" HREF="numericObjects.html">
<LINK REL="up" HREF="numericObjects.html">
<LINK REL="next" HREF="longObjects.html">
</HEAD>
<BODY bgcolor="#ffffff">
<div class=navigation>
<table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="longObjects.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="numericObjects.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="numericObjects.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Python/C API Reference Manual</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><img width=32 height=32 align=bottom border=0 alt=""
 src="../icons/blank.gif"></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="longObjects.html">7.4.2 Long Integer Objects</A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="numericObjects.html">7.4 Numeric Objects</A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="numericObjects.html">7.4 Numeric Objects</A></span>
<br><hr></div>
<!--End of Navigation Panel-->

<H2><A NAME="SECTION009410000000000000000"></A>
<BR>
7.4.1 Plain Integer Objects 
</H2>

<P>
<dl><dt><b><a name="l2h-219"><tt class=ctype>PyIntObject</tt></a></b>
<dd>
This subtype of <tt class=ctype>PyObject</tt> represents a Python integer object.
</dl>

<P>
<dl><dt>PyTypeObject <b><a name="l2h-220"><tt class=cdata>PyInt_Type</tt></a></b>
<dd>
This instance of <tt class=ctype>PyTypeObject</tt> represents the Python plain 
integer type.
</dl>

<P>
<dl><dt>int <b><a name="l2h-221"><tt class=cfunction>PyInt_Check</tt></a></b> (<var>PyObject *</var>)
<dd>

<P>
</dl>

<P>
<dl><dt>PyObject* <b><a name="l2h-222"><tt class=cfunction>PyInt_FromLong</tt></a></b> (<var>long ival</var>)
<dd>
Creates a new integer object with a value of <var>ival</var>.

<P>
The current implementation keeps an array of integer objects for all
integers between <tt>-1</tt> and <tt>100</tt>, 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 <tt>1</tt>. I
suspect the behaviour of Python in this case is undefined. :-)
</dl>

<P>
<dl><dt>long <b><a name="l2h-223"><tt class=cfunction>PyInt_AS_LONG</tt></a></b> (<var>PyIntObject *io</var>)
<dd>
Returns the value of the object <var>io</var>.  No error checking is
performed.
</dl>

<P>
<dl><dt>long <b><a name="l2h-224"><tt class=cfunction>PyInt_AsLong</tt></a></b> (<var>PyObject *io</var>)
<dd>
Will first attempt to cast the object to a <tt class=ctype>PyIntObject</tt>, if
it is not already one, and then return its value.
</dl>

<P>
<dl><dt>long <b><a name="l2h-225"><tt class=cfunction>PyInt_GetMax</tt></a></b> ()
<dd>
Returns the systems idea of the largest integer it can handle
(<tt class=constant>LONG_MAX</tt>, as defined in the system header files).
</dl>

<P>
<p>
<div class=navigation><hr><table align=center width="100%" cellpadding=0 cellspacing=2>
<tr>
<td><A HREF="longObjects.html"><img width=32 height=32 align=bottom border=0 alt="next"
 src="../icons/next.gif"></A></td>
<td><A HREF="numericObjects.html"><img width=32 height=32 align=bottom border=0 alt="up"
 src="../icons/up.gif"></A></td>
<td><A HREF="numericObjects.html"><img width=32 height=32 align=bottom border=0 alt="previous"
 src="../icons/previous.gif"></A></td>
<td align=center bgcolor="#99CCFF" width="100%">
 <b class=title>Python/C API Reference Manual</b></td>
<td><A HREF="contents.html"><img width=32 height=32 align=bottom border=0 alt="contents"
 src="../icons/contents.gif"></A></td>
<td><img width=32 height=32 align=bottom border=0 alt=""
 src="../icons/blank.gif"></td>
<td><A HREF="genindex.html"><img width=32 height=32 align=bottom border=0 alt="index"
 src="../icons/index.gif"></A></td>
</tr></table><b class=navlabel>Next:</b> <span class=sectref><A HREF="longObjects.html">7.4.2 Long Integer Objects</A></span>
<b class=navlabel>Up:</b> <span class=sectref><A HREF="numericObjects.html">7.4 Numeric Objects</A></span>
<b class=navlabel>Previous:</b> <span class=sectref><A HREF="numericObjects.html">7.4 Numeric Objects</A></span>
</div>
<!--End of Navigation Panel-->
<ADDRESS>
<hr>Send comments on this document to <a href="mailto:python-docs@python.org">python-docs@python.org</a>.
</ADDRESS>
</BODY>
</HTML>
