Mark Dickinson <dicki...@gmail.com> added the comment: (Adding Raymond to the nosy list.)
In r68494, I've checked in some work towards rewriting Decimal (or parts of Decimal) in C. I reused Facundo's old /decimal directory in the sandbox, so the URL is: http://svn.python.org/view/sandbox/trunk/decimal/decimal_in_c/ What's there is a fully functional hybrid Python and C implementation of decimal. All the existing decimal tests pass, at least on my machine. There's very little performance increase to boast of at the moment, but that may change. To try it, check out the directory and follow the README instructions. This probably doesn't work on Windows; help fixing that would be appreciated. The code is for py3k only; I started out maintaining versions for both 2.x and 3.x, but that was just too painful. I'd rather get the py3k version working, then backport. The main files are: deccoeff.c: contains classes Deccoeff and _Decimal. Deccoeff implements base 10 nonnegative integer arithmetic: its instances can be treated as integers, but also sliced as though they were strings, which makes rounding and shifting operations simple. _Decimal is a minimal base class for Decimal; the idea is to move functions from Decimal to _Decimal over time. decimal.py: version of Lib/decimal.py, fixed to use Deccoeff instead of string for the coefficient. As I see it, there are two goals for this work: (1) Speed decimal up. (2) Bring proposals to add a decimal literal to C closer to realizability. By the way, presumably it's not a prerequisite for (2) that *all* of the decimal.py functionality be recoded in C? I could imagine a situation where the decimal literals are present in the core, but an 'import decimal' was necessary to get complete functionality. _______________________________________ Python tracker <rep...@bugs.python.org> <http://bugs.python.org/issue2486> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com