Joan M. Garcia schrieb: > Following the feedback on the first release of magnitude it > has changed enough to deserve a second release, which > modifies the API, solves a couple of bugs, and brings it in > line with python's style guide. Main changes: > > * imul, idiv had wrong output unit, so that after a /= b > printing showed wrong units. > > * mod's output has the units of the division. > > * outputPrecission, defaultFormat and outputUnits are now > output_precision, default_format and output_units. > > > Magnitude: > > A physical quantity is a number with a unit, like 10 > km/h. Units can be any of the SI units, plus a bunch of > non-SI, bits, dollars, and any combination of them. They can > include the standard SI prefixes. Magnitude can operate with > physical quantities, parse their units, and print them. You > don't have to worry about unit consistency or conversions; > everything is handled transparently. By default output is > done in basic SI units, but you can specify any output unit, > as long as it can be reduced to the basic units of the > phisical quantity. > > Home page: http://juanreyero.com/magnitude/
Three comments, from looking at it: - "physical", not "phisical" ;-) - you raise string exceptions in various places; these are deprecated and should not be used. Also it is very difficult to catch them. - ScientificPython from Konrad Hinsen also contains a somewhat similar module. IIRC, it is named PhysicalQuantities. You might look into that and mention it on the homepage. Thomas -- http://mail.python.org/mailman/listinfo/python-list