On Tue, 07 Oct 2008 19:36:12 +1300, Lawrence D'Oliveiro 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?
This thread may be dead by now, but just for the record "dimensions" are not "units". 1 inch and 1 kilometre have the same dimension (Length) but obviously they can't be added to make 2 inches (or 2 kilometres). On the other hand, dimensions are very handy for sanity results; if somebody suggested to me that adding 15 inch second per gram to 195 cm month per tonne gave 6.7 gallons per millgram hour, I don't even need to do the conversion to see that this *must* be wrong because the dimensions don't match: the original arguments have dimensions Length*Time/Mass but the supposed argument has dimensions L**3/(M*T). Dimensions are useful to check if quantities are compatible, but you still need to convert them to a common unit. -- Steven -- http://mail.python.org/mailman/listinfo/python-list