[Python-3000] C API for ints and strings (original) (raw)
Nicholas Bastin nick.bastin at gmail.com
Sat Sep 8 19:41:10 CEST 2007
- Previous message: [Python-3000] C API for ints and strings
- Next message: [Python-3000] C API for ints and strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]
On 9/8/07, Guido van Rossum <guido at python.org> wrote:
On 9/8/07, Marcin 'Qrczak' Kowalczyk <qrczak at knm.org.pl> wrote: > I see that PyInt* functions are aliases for PyLong*. Which ones > should I use for the long term? There are no PyInt equivalents of > PyLongFromLongLong nor PyLongAsLongLong.
Use PyLong for now. Eventually we may rename them all; then we'll provide a renaming tool or macros. > Why is PyLongFitsInLong private? I don't know; perhaps because it doesn't always give the best answer. > In order to convert a Python3 int to > another numeric representation, I would like to check if it fits in a C > long, and convert via a string only if it does not. Should I use > PyLongAsLong + PyErrOccurred? I think either is fine. PyLongFitsInLong() will only get better over time. :-)
Speaking of PyLong, and its' minor awkwardness to work with in C (you either have to convert to another multiple-precision type through a string, or use Python's arithmetic operators directly), was there any thought given to using something like GPM's mpz_t as the backing data type?
-- Nick
- Previous message: [Python-3000] C API for ints and strings
- Next message: [Python-3000] C API for ints and strings
- Messages sorted by: [ date ] [ thread ] [ subject ] [ author ]