General Ledger/Accounting Libraries

Hornberger, Chris Chris.Hornberger at blackrock.com
Thu May 13 11:36:13 EDT 2004


>It does lead to some awkward code. For example, to calculate a value
>from a quantity and a price, I have to say
>
>    value = int(round(price * value / 1000000.0))
>
>This requires you to know what scale is used for each column, so
>mistakes are easy to make. As you say, the Decimal package, when it is
>released, will make life much easier.

That's a nice work around. You could store the scales in the db and read them at app-startup and store them in a settings collection/class, thus eliminating hard-coding scale computations. You could also make that flexible by grabbing a prerelease decimal package and coding against both models, teaching your app how to load decimal if it's available or falling back to scale/math when necessary. Might mean a tad more db maintenance up front, but also ensures a safe and robust distributable software package.

*shrugs*

It's an idea.




More information about the Python-list mailing list