On 7 Ott, 08:36, Lawrence D'Oliveiro <[EMAIL PROTECTED] central.gen.new_zealand> wrote: > In message <[EMAIL PROTECTED]>, Gabriel > > Genellina wrote: > > As an example, in the oil industry here in my country there is a mix of > > measurement units in common usage. Depth is measured in meters, but pump > > stroke in inches; loads in lbs but pressures in kg/cm². > > Isn't the right way to handle that to attach dimensions to each number?
Can you afford to avoid floats and ints? Attaching suffixes is the best one can do with the builtin types. In C++ one can check dimensions at compile time (http://www.boost.org/ doc/libs/1_36_0/doc/html/boost_units.html) with a modest increase of cumbersomeness, but Python would need very heavyweight classes containing a value and its dimension and a replacement of all needed functions and operations. Regards, Lorenzo Gatti -- http://mail.python.org/mailman/listinfo/python-list