boolean true and false values.

Alex Martelli alex at magenta.com
Tue Jun 27 09:43:59 EDT 2000


Albert Hofkamp <hat at se-46.wpa.wtb.tue.nl> wrote in message
news:slrn8lgsjq.us.hat at se-46.wpa.wtb.tue.nl...
    [snip]
> Until now, I like the basic idea of Python of variables not having a type,
but
> I don't really see the advantage.

Polymorphism based on exactly those parts of the signature that
one happens to use.  A BREEZE to explain to smart non-programmers.


> >As can any tool, of course. The dynamic typing is indeed never /needed/
> >(probably one of the things Dijkstra proved!), but it's often very /very/
> >convenient indeed. If it's likely to be a problem to you -- or to the
>
> Hmm, why is it convenient then ?
> Without declarations you can simply pick another identifier when you need
a new
> variable, rather than re-use existing identifiers, which may cause all
kind of
> bugs and/or hamper readability.

    a = someKindOfThing()
    a.prebalooze()
    if someCondition():
        a = someDifferentThing()
    a.foomeegate()

As long as the objects returned from someKindOfThing() and
someDifferentThing()
both have a .foomeegate() method that does the right thing, this just works.
Of course it's an error if .foomegate() does not exist or does inappropriate
stuff.  This is "intuitive" to a smart person who is not a programmer and
has
never been exposed to "type" as a concept.

Having to declare a as holding a reference to "something which has the
following methods respecting the following invariants" (a type or signature
characterized type) seems to be much less intuitive and therefore much
less convenient.  Such elegant conveniences are part of what makes Python
such a pleasure to learn, and to teach.


Alex






More information about the Python-list mailing list