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

Paul Moore p.f.moore at gmail.com
Tue Oct 20 23:00:12 CEST 2009

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

> I know that ultimately there should be a PEP for module inclusions. The
> purpose of this post is to gauge interest. Specifically:
> 1. Are you generally in favour of a C decimal module in Python?

Yes, although I have to admit my interest is fairly theoretical.

> 2. Would fastdec - after achieving full decimal.py compatibility - be
>   a serious candidate?

I don't see why not, if it was 100% compatible with decimal.py

> 3. Could I use this list to settle a couple of questions, or would perhaps
>   a Python developer be willing to work with me to make it compatible? I'm
>   asking this to avoid doing work that would not find acceptance afterwards.

I can't help much here, but I'd prefer to see discussions on
python-dev so I'm +1 on keeping discussions here.

Waiting eagerly to hear the experts' comments...


More information about the Python-Dev mailing list