Lisandro Dalcin wrote:
On 7/18/06, Tim Peters <[EMAIL PROTECTED]> wrote:
  
[Raymond Hettinger]
    
...
If the current approach gets in their way, the C implementers should feel free to
make an alternate design choice.
      
I expect they will, eventually.  Converting this to C is a big job,
and at the NFS sprint we settled on an "incremental" strategy allowing
most of the module to remain written in Python, converting methods to
C one at a time.  Changing the user-visible API is a hard egg to
swallow, and it's unfortunate that the Python code used a dict to hold
"flags" to begin with.  The dict doesn't just record whether an
exception has occurred, it also counts how many times the exception
occurred.  It's possible that someone, somewhere, has latched on to
that as "a feature".
    

Why not a 'cDecimal' module instead?
  

Good answer. 

My recommendation is that instead of "eventually", we bite the bullet now.  The development path for decimal can follow that for sets where the lessons from sets.py were used to make an improved API for the C version while leaving the pure Python verion unmodified.  Realizing that "it's unfortunate that the Python code used a dict to hold flags to begin with", the C implementers for decimal should move on to more sensible choices.

Also, I have to take the blame for encouraging the "incremental" migration approach.  I thought we could get some quick wins on the most common called parts of the module.  Now, I can see that this approach will result in nasty, convoluted C code that falls far short of its performance potential and is a nightmare to maintain.  Looking at some of the checkins, it is now clear to me that there are substantial benefits to divorcing the base C implementation of decimal from the Python C API.


Raymond




_______________________________________________
Python-Dev mailing list
Python-Dev@python.org
http://mail.python.org/mailman/listinfo/python-dev
Unsubscribe: 
http://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com

Reply via email to