[Python-3000] C API for ints and strings (original) (raw)
Guido van Rossum guido at python.org
Sat Sep 8 19:12:00 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, 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.
Should I continue to use PyUnicode* functions for the new str?
Correct. Again, eventually we may rename.
What is the status of the str8 type? Is it kept temporarily until the modules are updated to Python3 str, or it is an official immutable bytes type? Its repr uses s'...' syntax which is not supported by the parser.
The problem with its repr() is a hint. ;-) it is a temporary hack until we don't need it any more. During and after the last sprint, Neal Norwitz did a lot of work towards getting rid of it, but more needs to be done. Help is welcome!
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. _PyLong_FitsInLong() will only get better over time. :-)
-- --Guido van Rossum (home page: http://www.python.org/~guido/)
- 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 ]