On Wed, Aug 24, 2016 at 11:57 PM, Greg Ewing <greg.ew...@canterbury.ac.nz> wrote: > Chris Angelico wrote: >> >> If units are retained, what you have is no longer a simple number, but >> a value with a unit, and is a quite different beast. (For instance, >> addition would have to cope with unit mismatches (probably by throwing >> an error), and multiplication would have to combine the units (length >> * length = area).) > > > And that can be surprisingly tricky. For example, newtons > times metres equals joules -- but *only* if the force and > the distance are in the same direction, otherwise it's > torque rather than energy and the units are just > newton-metres.
I'd say that it more accurately depends on whether the distance represents a displacement or a position of application. If one pushes a shopping cart off-center, that produces both work and torque, with different "distance" vectors for each. Analytically, one is a cross-product and the other is a dot-product. The unit matching engine would have to understand the difference and know which one is being applied in the calculation. _______________________________________________ Python-ideas mailing list Python-ideas@python.org https://mail.python.org/mailman/listinfo/python-ideas Code of Conduct: http://python.org/psf/codeofconduct/