does lack of type declarations make Python unsafe?

Anton Vredegoor anton at vredegoor.doge.nl
Fri Jul 4 13:09:05 CEST 2003


david.abrahams at rcn.com (David Abrahams) wrote:

>anton at vredegoor.doge.nl (Anton Vredegoor) wrote in message news:<bdnite$lsg$1 at news.hccnet.nl>...
>> david.abrahams at rcn.com (David Abrahams) wrote:
>>  <700+ LOP>
>> >I love a nice jestful debate.  Maybe your whole post is jestful and I
>> >failed to recognize it.  It certainly seems to have a derisive tone
>> >which makes it hard to see the love.  Where's the love, people?
>> >Anyway, if you tell me you didn't mean it that way I'll take your word
>> >for it.
>> 
>> Perhaps not love, to me both you guys are discussing trifles. TDD and
>> the source of it, static typing, are both about being satisfied with
>> just passing tests, while the really important discussion -for me at
>> least- is about aligning the code with ones thoughts, and how to
>> accomplish that. 
>
>I think that's *exactly* what I was talking about.  Type declarations
>on function parameters help me to align the code with the thoughts I
>have about the implicit contract with the function's callers.  In the
>process, it makes that contract more explicit.

Suppose (because of some perceived derisive tone f.e.) you would state
not to marry Alex. Would that automatically imply you being a female?
Perhaps it would indicate that in your opinion *Alex* [1] is a female?
Furthermore suppose you're from a country where same-sex marriages are
legal, would such a statement automatically imply that you are gay?

The trouble with implicit assumptions is that they're possibly
invalid, and as the Python Zen states: "In the face of ambiguity
refuse the temptation to guess". It's hard to see that Zen to be
overridden with "explicit is better than implicit" when no explicit
information is available, for example because of short circuiting [2].

I think the discussion about type checking has reached a state where
it is possible to compare it with for example the need for proofs in a
mathematical paper. Proofs are what defines a mathematical paper, but
alas, some heuristics indicate that for every formula used in a paper
the audience is halved. As a former psychologist working in a
mathematics department -also formerly- I noticed that, while
psychologists seem to be concerned with the validity of the data [3],
mathematicians were primarily concerned with the correctness of the
formulas used to evaluate the data.

There's some saying among psychologists that "if one needs a lot of
statistics to prove some fact, it's already doubtful that one is
really measuring that what one is supposed to measure".

On the other hand if the mathematical foundation of a test is not good
it's clear that the conclusions of a test are not convincing.

Sometimes practicality dictates that tests are necessary, but at the
same time it's clear that very elaborate statistical methods on data
that do not warrant such extrapolations can trick innocent readers (of
scientific articles f.e.) into believing false conclusions because
their implicit assumptions almost force them to do so.

Do we have some kind of tradeoff here?

Anton [4]

[1] Judging from some Europython photos for *some* Alex this seems not
to be the case 

[2]The fact is that for some people agreement comes even *before* sex
checking. Other people first check the sex before marrying, possibly
to their detriment because sexuality has a tendency to make one forget
the more important protocol once one has set only a foot upon that
path.

However if in type checking country it's probably best to take a role,
so please note that I'm male and not gay.

But you'd probably be surprised to see what's *really* behind some of
the email addresses here :-)

[3] It makes a *lot* of difference how a question is phrased, and also
the circumstances of the testing venue and the assumptions of the
tester can substantially influence the outcome of tests, even the
outcome of tests which have close to zero human intervention
(sometimes even the *absence* of human intervention distorts testing
results)

[4] Who has seen the vanity of psychological tests *and* the vanity of
mathematical evaluation of such tests, and has doubts about the vanity
of type checking and testing altogether






More information about the Python-list mailing list