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

Stefan Krah stefan-usenet at bytereef.org
Thu Oct 22 11:10:34 CEST 2009


Mark Dickinson <dickinsm at gmail.com> wrote:
> Thanks, Antoine!  With SLOCCount I can revise my earlier numbers, as well:
> Here's Stefan Krah's mpdecimal, version 0.80:
> 
>   SLOC	Directory	SLOC-by-Language (Sorted)
>   21445   top_dir         ansic=21267,sh=105,python=55,asm=18
>   6238    python          python=6177,java=43,sh=18
>   1403    tests           ansic=1356,sh=47
>   476     literature      lisp=476
>   274     cmd             ansic=274
>   11      tools           sh=11
>   0       doc             (none)

I would say that the relevant code is less than that: The module code is
counted twice (fastdec2.c, fastdec3.c), and sloccount counts the inline
functions in the mpdecimal*.h header files. So, after removing fastdec3.c,
mpdecimal32.h, mpdecimal32vc.h, mpdecimal64vc.h, I get:

SLOC    Directory       SLOC-by-Language (Sorted)
13702   top_dir         ansic=13524,sh=105,python=55,asm=18
6238    python          python=6177,java=43,sh=18
1403    tests           ansic=1356,sh=47
476     literature      lisp=476
274     cmd             ansic=274
11      tools           sh=11
0       doc             (none)


Totals grouped by language (dominant language first):
ansic:        15154 (68.56%)
python:        6232 (28.19%)
lisp:           476 (2.15%)
sh:             181 (0.82%)
java:            43 (0.19%)
asm:             18 (0.08%)


Therefore, my estimate is between 12660 and 13702 lines, depending on whether
to count the remaining mpdecimal64.h (Most inline functions in this header
file are signaling wrappers around the quiet functions and are not necessary
for the module).

If one takes out all library functions that the module does not use, I'm
sure it could be condensed to ~11500 lines.


This is comparable to the expat directory in Modules/:

SLOC    Directory       SLOC-by-Language (Sorted)
11406   expat           ansic=11406


Stefan Krah





More information about the Python-Dev mailing list