"Strong typing vs. strong testing"
Pascal J. Bourguignon
pjb at informatimago.com
Wed Oct 13 17:28:42 CEST 2010
Steven D'Aprano <steve at REMOVE-THIS-cybersource.com.au> writes:
> Hmmm, my ISP's news software really doesn't like it when I cross-post to
> more than three newsgroups. So, trying again without comp.lang.c.
>
> On Wed, 13 Oct 2010 02:00:46 +0100, BartC wrote:
>
>> "RG" <rNOSPAMon at flownet.com> wrote in message
>> news:rNOSPAMon-20651E.17410012102010 at news.albasani.net...
>>> In article <i92dvd$ada$1 at news.eternal-september.org>, "BartC"
>>> <bc at freeuk.com> wrote:
>>>
>>>> "Thomas A. Russ" <tar at sevak.isi.edu> wrote in message
>>
>>>> > But radians are dimensionless.
>>>>
>>>> But they are still units
>>>
>>> No, they aren't.
>>>
>>>> so that you can choose to use radians, degrees or gradians
>>>
>>> Those aren't units either, any more than a percentage is a unit. They
>>> are just different ways of writing numbers.
>>>
>>> All of the following are the same number written in different
>>> notations:
>>>
>>> 0.5
>>> 1/2
>>> 50%
>>>
>>> Likewise, all of the following are the same number written in different
>>> notations:
>>>
>>> pi/2
>>> pi/2 radians
>>> 90 degrees
>>> 100 gradians
>>> 1/4 circle
>>> 0.25 circle
>>> 25% of a circle
>>> 25% of 2pi
>>>
>>> See?
>>
>> But what exactly *is* this number? Is it 0.25, 1.57 or 90?
>
> That's the wrong question. It's like asking, what exactly "is" the number
> twenty-one -- is it "one and twenty", or 21, or 0x15, or 0o25, or 21.0, or
> 20.999... recurring, or 63/3, or XXI, or 0b10101, or "vinet et un", or any
> one of many other representations.
This is not the wrong question. These are two different things.
In the case of 0.25, 1.57 or 90, you have elements of the same set of
real numbers ℝ, which are used to represent the same entity, which IS NOT
a number, but an angle. Angles are not in the ℝ set, but in ℝ/2π, which
is an entirely different set with entirely different properties.
In the other case, we have strings "21", "0x15", "0o25", "21.0",
"20.999...", "63/3", "XXI", "0b10101", "vingt et un", that represent the
same number in ℝ.
So you have different pairs of sets and different representationnal
mapping. There's very little in common between an angle of 90 degree,
and the number 21.
> Likewise, it doesn't matter whether you write 45° or π/4 radians, the
> angle you are describing -- the number -- is the same.
No. The numbers ARE different. One number is 45, the other is π/4.
What is the same, is the angle that is represented.
I cannot fathom how you can arrive at such a misunderstanding. It's
rather easy to picture out:
ℝ.... .....ℝ/2π......................
: : : :
: : degree : full turn :
: 45 ----------------------\ :
: : : \ :
: : : angle of an eighth of a turn :
: : radian : / :
: π/4 ---------------------/ :
: : : quarter turn :
: : : :
....... ................................
--
__Pascal Bourguignon__ http://www.informatimago.com/
More information about the Python-list
mailing list