[Python-3000] C API for ints and strings (original) (raw)

Nicholas Bastin nick.bastin at gmail.com
Sat Sep 8 22:47:56 CEST 2007


On 9/8/07, "Martin v. Löwis" <martin at v.loewis.de> wrote:

> 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 mpzt as the backing data > type?

I never did that.

Would anyone be opposed to rehosting PyLong on top of GMP? I'm not necessarily volunteering to do the work (yet, anyhow), but just trying to get a read on the feelings of the community. PyLong has historically been a bit of a pain to deal with if you embedded or extended python, or otherwise had to deal with it at the C API level. With the distinction between int and long being removed at the user level, it will become more un-pythonic to refuse to accept long integers in some extensions.

Additionally, something like GMP would likely provide improved performance, and would be a piece of code, perhaps out of the core domain knowledge of the core python developers, that we would not have to maintain. On the other hand, GMP would become a required library, not one simply built against if you had it (provided that the issues with the pervasiveness of the use of OpenSSL are resolved, no external library is currently required for 'normal' operation of the interpreter). Would we want to maintain parallel implementations? Does this provide a barrier to entry to some platform ports? (I think not, since it doesn't change the definition of the language, but it's worth asking).

-- Nick



More information about the Python-3000 mailing list