← Back to team overview

c2c-oerpscenario team mailing list archive

Re: [Bug 663045] [NEW] using the decimal module instead of __builtins__.float

 

On Tuesday 19 October 2010, you wrote:
> You have been subscribed to a public bug:
> 
> I just had a look at the decimal module introduced in python 2.4 [1],
> and after another glance at the float field.
> 
> Is there a reason why we don't use the rounding-agnostic decimal module
> instead of the float type?
> 
> As far as I can see, only a few lines should be changed, something like
> this in fields.py:float
> 
> _symbol_f = lambda x: decimal.Decimal(str(x) or '0.0')
> 

There is one, pretty big reason, why this Decimal vs. Float discussion (which 
has happened quite many times, already), is not the Holy Grenade that will 
solve all our troubles:

	Our data is kept in the Database.
        We DON'T perform everything in Python[1].

And, yes, performance is also a major factor to consider. The fact that 
decimal numbers (in both python and sql) are 100 times slower, is quite 
important for a system that wants to be fast and scalable.

[1] and if we do, that would be a problem already.


-- 
Say NO to spam and viruses. Stop using Microsoft Windows!

-- 
using the decimal module instead of __builtins__.float
https://bugs.launchpad.net/bugs/663045
You received this bug notification because you are a member of C2C
OERPScenario, which is subscribed to OpenERP OpenObject.

Status in OpenObject Server: Opinion

Bug description:
I just had a look at the decimal module introduced in python 2.4 [1], and after another glance at the float field.

Is there a reason why we don't use the rounding-agnostic decimal module instead of the float type?

As far as I can see, only a few lines should be changed, something like this in fields.py:float

_symbol_f = lambda x: decimal.Decimal(str(x) or '0.0')

[1]: http://docs.python.org/library/decimal.html





References