[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]
Subject: CONVERT - why not metric prefixes everywhere?
CONVERT accepts the metric prefixes for various units. It's not clear why the prefixes should be limited to the metric units, so I did a quick test to see if there's a problem if the prefixes are just accepted everywhere. The attached program creates all possible combinations, and no conflict was found. There isn't even a problem if you also permit binary prefixes (Mi, etc.) everywhere, and support b (bit) and B (Byte) units. You would only use those prefixes for information units, but even permitting them everywhere doesn't seem to be a problem. Is there some reason the metric prefixes shouldn't be just accepted everywhere? And should we also permit "b" (bit) and "Byte", along with binary prefixes for these two? If we want to limit the prefix support, we need to clearly identify which units get the prefixes. That gets tricky - how about seconds? Years? Celcius? Kelvin? --- David A. Wheeler =========================== CUT HERE==================== #!/usr/bin/python # list-convert-conflicts - lists the conflicts in CONVERT units. prefixes = [ "K", "E", "P", "T", "G", "M", "k", "h", "e", "d", "c", "m", "u", "n", "p", "f", "a", # Add binary prefixes, to see if they'll cause trouble. # Permit both ki and Ki. "Ei", "Pi", "Ti", "Gi", "Mi", "ki", "Ki" ] unitnames = [ "ang", "ft", "in", "m", "Nmi", "Pica", "mi", "yd", "BTU", "eV", "e", "flb", "HPh", "cal", "dyn", "N", "lbf", "cup", "oz", "gal", "l", "qt", "tbs", "tsp", "uk_pt", "pt", "ga", "T", "J", "c", "Wh", "sg", "u", "HP", "W", "atm", "mmHg", "Pa", "C", "F", "K", "day", "hr", "mn", "sec", "yr", # Add B (byte) and b (bit), to see if they'll cause trouble if added "B", "b" ] allunits = {} for prefix in prefixes: for unitname in unitnames: # print prefix + unitname unit=prefix + unitname separated_unit=prefix + " " + unitname if unit in allunits: print "Problem duplicate:", allunits[unit], "and", separated_unit else: allunits[unit] = separated_unit print "Done."
[Date Prev] | [Thread Prev] | [Thread Next] | [Date Next] -- [Date Index] | [Thread Index] | [List Home]