"Strong typing vs. strong testing"
python at mrabarnett.plus.com
Wed Oct 13 04:28:42 CEST 2010
On 13/10/2010 02:36, Keith Thompson wrote:
> "BartC"<bc at freeuk.com> writes:
>> "RG"<rNOSPAMon at flownet.com> wrote in message
>> news:rNOSPAMon-20651E.17410012102010 at news.albasani.net...
>>> Likewise, all of the following are the same number written in different
>>> pi/2 radians
>>> 90 degrees
>>> 100 gradians
>>> 1/4 circle
>>> 0.25 circle
>>> 25% of a circle
>>> 25% of 2pi
>> But what exactly *is* this number? Is it 0.25, 1.57 or 90?
> It's approximately 1.57.
>> I can also write 12 inches, 1 foot, 1/3 yards, 1/5280 miles, 304.8 mm and so
>> on. They are all the same number, roughly 1/131000000 of the polar
>> circumference of the Earth.
> They aren't bare numbers, they're lengths (actually the same length).
>> This does depend on the actual size of an arbitrary circle, but that seems
>> little different from the choice of 0.25, 1.57 or 90 for your quarter
> The radian is defined as a ratio of lengths. That ratio is the same
> regardless of the size of the circle. The choice of 1/(2*pi) of the
> circumference isn't arbitrary at all; there are sound mathematical
> reasons for it. Mathematicians could have chosen to set the full
> circumference to 1, for example, but then a lot of computations
> would contain additional multiplications and/or divisions by 2*pi.
Being able to 'tag' values can help in some cases, much like the idea
of 'tainting' user input and having that taint propagate until it's
explicitly cleaned. Being able to tag a value as 'radians' can be
helpful. Consider the original purpose of Hungarian notation.
More information about the Python-list