"Strong typing vs. strong testing"

Steven D'Aprano steve at REMOVE-THIS-cybersource.com.au
Wed Oct 13 15:40:33 EDT 2010


On Wed, 13 Oct 2010 17:28:42 +0200, Pascal J. Bourguignon wrote:

>>> 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.

Which is why I said it was LIKE asking the second.


> 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.

It's quite standard to discuss (say) sin(theta) where theta is an element 
of ℝ. The fact that angles can extent to infinity in both directions is 
kind of fundamental to the idea of saying that the trig functions are 
periodic.

> 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.

Would it have been easier to understand if I had made the analogy between 
angles and (say) time? A time of 1 minute and a time of 60 seconds are 
the same time, regardless of what representation you use for it.


>> 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.

Fair enough. I worded that badly.




-- 
Steven



More information about the Python-list mailing list