On Thu, Dec 4, 2008 at 12:00 AM, Raymond Hettinger <python@rcn.com> wrote:
From: "Chris Rebert" <clp@rebertia.com>
With Python 3.0 being released, and going over its many changes, I was reminded that decimal numbers (decimal.Decimal) are still relegated to a library and aren't built-in.
Has there been any thought to adding decimal literals and making decimal a built-in type?
It's a non-starter until there is a fast, clean C implementation of decimal. The current module is hundreds of times slower than binary floats.
Does performance matter quite *that* critically in most everyday programs? If people need such ruthless speed, they can use floats and accept the consequences or use another language entirely (e.g. C, C++, OCaml) as Python would be too slow even as it currently is. We're talking about giving people the option to explicitly, in a less cumbersome way, make that choice of correctness over performance. If slowing startup time for the interpreter is what worries you, a 'from __future__ import' directive could be required and the timeline for full built-in-ness pushed back. Also, by "built-in" I didn't mean to necessarily imply "written in C", but rather "being present in the builtin namespace and available by default". That said, there appears to be decNumber (http://speleotrove.com/decimal/#decNumber), an ANSI C implementation of the General Decimal Arithmetic spec to which Decimal.decimal adheres. At least there's a place to start. Cheers, Chris -- Follow the path of the Iguana... http://rebertia.com
Raymond