
On Tue, 2 Mar 2010 20:37:29 +0100 George Sakkis <george.sakkis@gmail.com> wrote:
On Tue, Mar 2, 2010 at 8:17 PM, Robert Kern <robert.kern@gmail.com> wrote:
On 2010-03-02 12:35 PM, Bill Janssen wrote:
I was looking at Martin Fowler's Quantity pattern earlier.
http://martinfowler.com/ap2/quantity.html
I remember writing this up as an idea for Fortran back in the early 80's, only to find a CACM paper from 1978 exploring the idea: "Incorporation of Units into Programming Languages", Karr& Loveman, May 1978.
But it would still be a cool idea for Python. Perhaps it's already there and I haven't noticed?
Tons of implementations (in no particular order):
http://pypi.python.org/pypi/quantities/ http://pypi.python.org/pypi/Unum/ http://pypi.python.org/pypi/magnitude/ http://pypi.python.org/pypi/units/ http://pypi.python.org/pypi/ScientificPython/ http://pypi.python.org/pypi/SciMath/
And quite a few more that are part of other packages or otherwise not on PyPI. It's ridiculously easy to write something that what people think are the common cases and so everyone does. It's a lot harder to write something that robustly handles what are actually common cases (absolute temperature scales, logarithmic scales, etc.).
One more: http://pypi.python.org/pypi/piquant/
I can't comment on its robustness and performance but as far as readability goes, Unum seems the best of the bunch.
Hmm. How about accessing the Frink (http://futureboy.homeip.net/frinkdocs/) types from Jython? <mike -- Mike Meyer <mwm@mired.org> http://www.mired.org/consulting.html Independent Network/Unix/Perforce consultant, email for more information. O< ascii ribbon campaign - stop html mail - www.asciiribbon.org