[Python-3000] Math in Python 3.0

Raymond Hettinger rhettinger at ewtllc.com
Thu May 11 23:07:11 CEST 2006


Fredrik Johansson wrote:

>
>Are people still positive regarding the idea of merging decimal and
>binary floats into the same type? (Or at least ensuring that they can
>be mixed seamlessly, which should be no problem with decimal literals
>added to the language.) 
>

IMO, the free mixing decimal and binary floats is not a good idea.


>Is someone currently working on a faster
>implementation of Decimal? 
>

It is a topic for the Iceland Sprint and on the project list for the 
Summer of Code.

>(how many times have you typed/read the
>mind-numbing expression "n%2 == 0"?).
>  
>

I write:

    if n&1:
       handle_odd()
    else:
       handle_even()

IMO, functions like is_even() and is_odd() are clutter.  Also, the 
performance of &1 is unlikely to be matched function calls.




>Anyone for PEP-writing? I can think of numerous small changes (and
>ideas too insane to suggest publicly on this list); perhaps a wiki
>page first?
>  
>

Better to start with sane ideas like a C implementation of decimal.

When it comes to numerous small changes, it is better to create a third 
party extension and see how it fares in the real-world.  I suspect that 
such a module would be ignored.  If that turns out to be true, then it 
means that the additions to the standard library are not warranted.


Raymond



More information about the Python-3000 mailing list