[Python-Dev] Interest in integrating C decimal module into Python?

Maciej Fijalkowski fijall at gmail.com
Wed Oct 21 00:49:28 CEST 2009

On Tue, Oct 20, 2009 at 3:00 PM, Paul Moore <p.f.moore at gmail.com> wrote:
> 2009/10/20 Stefan Krah <stefan-usenet at bytereef.org>:
>> Hi,
>> as some of you know, recently I've released an arbitrary precision
>> C library for decimal arithmetic together with a Python module:
>> http://www.bytereef.org/libmpdec.html
>> http://www.bytereef.org/fastdec.html
>> Both the library and the module have been tested extensively. Fastdec
>> currently differs from decimal.py in a couple of ways that could be
>> fixed. The license is AGPL, but if there is interest in integrating it
>> into Python I'd release it under a Python-compatible license.
>> There have been several approaches towards getting C decimal arithmetic
>> into Python:
>> http://bugs.python.org/issue2486
>> Fastdec follows Raymond Hettinger's suggestion to provide wrappers for
>> an independent C implementation. Arguments in favour of fastdec are:
>>  * Complete implementation of Mike Cowlishaw's specification
>>  * C library can be tested independently
>>  * Redundant arithmetic module for tests against decimal.py
>>  * Faster than Java BigDecimal
>>  * Compares relatively well in speed against gmpy
>> To be clear, I would not want to _replace_ decimal.py. Rather I'd like to
>> see a cdecimal module alongside decimal.py.
> Why? If it's 100% compatible with decimal.py, just replace it. All the
> user should see is improved speed. Let's not do another
> pickle/cpickle.

For example other python implementations might decide to use python
version as long as builtin version does not appear. Python versions are
usually also better targets for jit than mixed versions. C level versions also
usually have more bugs (just statistics), so some people might want to
choose pure-python version.

In general - some people have some reasons.


More information about the Python-Dev mailing list