[Python-ideas] the Quantity pattern
robert.kern at gmail.com
Wed Mar 3 04:35:00 CET 2010
On 2010-03-02 20:14 , Darren Dale wrote:
> On Tue, Mar 2, 2010 at 2:17 PM, Robert Kern<robert.kern at gmail.com> wrote:
>> On 2010-03-02 12:35 PM, Bill Janssen wrote:
>>> I was looking at Martin Fowler's Quantity pattern earlier.
>>> 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
>>> 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):
>> 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.).
> I prefer to think of this as two separate issues. One issue is a
> Quantity pattern for dealing with values that have magnitude and
> dimensionality, and the other is coordinate systems (requiring a point
> of reference, like temperature scales).
Theoretically and implementation-wise, absolutely. However, users want to
convert Fahrenheit to Celsius with the same tool they use to convert meters to
feet. To them, it's the same problem.
"I have come to believe that the whole world is an enigma, a harmless enigma
that is made terrible by our own mad attempt to interpret it as though it had
an underlying truth."
-- Umberto Eco
More information about the Python-ideas