William Stein wrote: > suggested doing almost precisely what Robert Dodier keeps telling us > to do, which is make the different units just be symbolic variables,
Well, in addition to implementing units as symbols, it greatly simplifies the whole business to keep the units separate from the quantities, instead of smashing them into the same multiplicative expression. Otherwise you have trouble distinguishing units from other terms. (You're going to allow symbolic quantities, not just numbers, right?) > * a very big list of different standard units (e.g., Foot, > Mile, Meter Second, etc.), which are all literally just symbolic > variables. I think it's fairly important to keep the names of things close to what people would scribble on a piece of paper. Unconventional capitalization and having to write out every name is going to make it clumsy to use. > sage: from units import mega, kilo, byte, second, giga, minute > sage: n = 94959 * kilo*byte > sage: n.convert(mega*byte) I recommend against mega, kilo, etc. Just append Mb, kb, etc to your list of conversions w/ Mb = 10^6*b, kb = 10^3*b, etc. Otherwise you get megas and kilos floating around in the units -- depending on the canonicalization of multiplicative expressions you'll get foo*mega where foo is some unit. FWIW Robert Dodier --~--~---------~--~----~------------~-------~--~----~ To post to this group, send an email to sage-devel@googlegroups.com To unsubscribe from this group, send an email to sage-devel-unsubscr...@googlegroups.com For more options, visit this group at http://groups.google.com/group/sage-devel URLs: http://www.sagemath.org -~----------~----~----~----~------~----~------~--~---