[Python-3000] PyInt_ to PyLong_ rename
Guido van Rossum
guido at python.org
Fri Dec 7 20:16:09 CET 2007
On Dec 7, 2007 11:06 AM, Gregory P. Smith <greg at krypto.org> wrote:
> On 12/3/07, Guido van Rossum <guido at python.org> wrote:
> > On Dec 2, 2007 12:56 PM, "Martin v. Löwis" <martin at v.loewis.de> wrote:
> > > > It's only used for sys.maxint. Do we still need sys.maxint and
> > > > PyInt_GetMax()? IMO PyLong_GetNativeMax() and sys.maxnativelong are
> > > > better names.
> > >
> > > I think they should go entirely. They don't give any interesting
> > > information about the Python implementation.
> >
> > Actually it's still somewhat interesting to be able to tell whether a
> > particular Python build uses 64-bit pointer or 32-bit pointers. (I
> > realize sys.maxint doesn't quite tell us this, but on Linux at least
> > it does.) I also suspecet that sys.maxint is used frequently for "some
> > large integer" used as an approximation of infinity in some context.
>
> It is, but it doesn't appear to common:
>
> http://www.google.com/codesearch?q=+sys.maxint
>
> Only turns up ~10 unique non-Python-itself projects using within the first 5
> pages of results. Much of the time it is used as a large number. Anyone
> porting that code forward to 2.6 or later can fix that.
>
> Please don't encourage its misuse for determining if the host has 32 or
> 64bit longs or pointers. It does not do that. Use platform.architecture()
> for the long size and look at the length of a hex pointer in the repr of a
> class for C pointer size.
sys.maxsize should be backported to 2.6.
--
--Guido van Rossum (home page: http://www.python.org/~guido/)
More information about the Python-3000
mailing list