Re: does lack of type declarations make Python unsafe?

Discussion in 'Python' started by Anton Vredegoor, Jun 29, 2003.

  1. (David Abrahams) wrote:
    <700+ LOP>
    >Alex Martelli <> writes:

    <snip>
    >> In Python one generally identifies (just as informally) a container as
    >> "an object which has a length" (using "length", perhaps a suboptimal
    >> choice of wording, to mean "number of items currently contained") and
    >> simultaneously express both 'c is a container' and 'that container is
    >> not empty' by
    >>
    >> assert len(c)

    >
    >That understanding of "containerness" is, AFAICT, not universally held
    >among Pythonistas by any means. Good thing too, probably: it looks
    >like there is no such thing as an empty container:
    >
    > >>> assert len([])

    > Traceback ...


    The following capture of an interactive session might be informative:

    Python 2.3b1 (#2, Apr 26 2003, 15:09:25)
    [GCC 2.95.3-5 (cygwin special)] on cygwin
    Type "help", "copyright", "credits" or "license" for more information.
    >>> len({})

    0
    >>> len([])

    0
    >>> assert 0

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    AssertionError
    >>>

    <snip>
    >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'm not yet talking about aligning ones thoughts
    with the universe, I wouldn't know how to start that :)

    Maybe it's like the Zen of shooting arrows, not aiming at the goal,
    but aiming to make the whole process flow naturally.

    Confronting the Martellibot is like flirting with an encyclopedia, I'd
    rather not do it myself, but I respect those who do, because it
    produces knowledge.

    Anton
    Anton Vredegoor, Jun 29, 2003
    #1
    1. Advertising

  2. (Anton Vredegoor) wrote in message news:<bdnite$lsg$>...
    > (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.

    -Dave
    David Abrahams, Jul 4, 2003
    #2
    1. Advertising

  3. (David Abrahams) wrote:

    > (Anton Vredegoor) wrote in message news:<bdnite$lsg$>...
    >> (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
    Anton Vredegoor, Jul 4, 2003
    #3
  4. (Anton Vredegoor) writes:

    > Confronting the Martellibot is like flirting with an encyclopedia, I'd
    > rather not do it myself, but I respect those who do, because it
    > produces knowledge.


    Yeah, and fun! I'm a little disappointed that Alex disappeared from
    this discussion because I thought it was going somewhere interesting
    and was looking forward to some more cogent arguments. Any chance of
    re-opening it, Alex? I'm referring, in particular, to
    http://tinyurl.com/gbq0


    --
    Dave Abrahams
    Boost Consulting
    www.boost-consulting.com
    David Abrahams, Jul 8, 2003
    #4
  5. Anton Vredegoor

    Aahz Guest

    In article <>,
    David Abrahams <> wrote:
    > (Anton Vredegoor) writes:
    >>
    >> Confronting the Martellibot is like flirting with an encyclopedia, I'd
    >> rather not do it myself, but I respect those who do, because it
    >> produces knowledge.

    >
    >Yeah, and fun! I'm a little disappointed that Alex disappeared from
    >this discussion because I thought it was going somewhere interesting
    >and was looking forward to some more cogent arguments. Any chance of
    >re-opening it, Alex? I'm referring, in particular, to
    >http://tinyurl.com/gbq0


    Alex has been busy with OSCON and other things; I don't expect him to
    make many contributions until he's back in Italy and caught up. If you
    want further discussion, I'd suggest reposting this when he starts
    posting here again.
    --
    Aahz () <*> http://www.pythoncraft.com/

    "Not everything in life has a clue in front of it...." --JMS
    Aahz, Jul 10, 2003
    #5
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Christopher Blunck
    Replies:
    0
    Views:
    1,167
    Christopher Blunck
    Jun 24, 2003
  2. Mark 'Kamikaze' Hughes

    Re: does lack of type declarations make Python unsafe?

    Mark 'Kamikaze' Hughes, Jun 29, 2003, in forum: Python
    Replies:
    4
    Views:
    791
    Anton Vredegoor
    Jul 1, 2003
  3. David Abrahams
    Replies:
    0
    Views:
    651
    David Abrahams
    Jun 30, 2003
  4. Cameron Laird
    Replies:
    0
    Views:
    288
    Cameron Laird
    Jul 2, 2003
  5. rockdale
    Replies:
    3
    Views:
    3,249
    rockdale
    Nov 3, 2006
Loading...

Share This Page