"Strong typing vs. strong testing"

Gregory Ewing greg.ewing at canterbury.ac.nz
Wed Oct 13 08:46:34 CEST 2010

Tim Bradshaw wrote:
> In general any function 
> which raises its argument to more than one power ...  doesn't make
> much sense if its argument has units.

That's not true. Consider the distance travelled by a
falling object: y(t) = y0 + v0*t + 0.5*a*t**2. Here t has
dimensions of time, and it's being raised to different
powers in different terms. It works because the
coefficents have dimensions too, and all the terms end up
having the same dimensions.

The commonly used transcendental functions (sin, log, etc.)
happen to take dimensionless arguments, but that's just a
property of those particular functions. (It's probably a
big part of the reason *why* they're commonly used -- they
wouldn't be nearly as general-purpose otherwise.)


More information about the Python-list mailing list