Static typing (was Re: Java guy interested in Python)

Hamish Lawson hamish_lawson at yahoo.co.uk
Fri Mar 9 12:53:17 EST 2001


Steve Purcell:

    You could indeed consider those an alternative, since a thorough
    test suite would find all the same errors.

Yes, I've tried to convince my static-typing-loving colleagues of the
claim of dynamic typing and test suites: a test suite can catch errors
that static typing can't; the static-typing furniture clutters up the
logic of your code; and the less flexible nature of statically-typed
code often makes the code longer (and hence takes a longer time to
write
and understand) than the dynamically-typed equivalent (even when a test
suite is lumped in with the latter).

Michael Hudson:

    I suspect that you'd basically end up listing the methods required,
    eg:

    def func(file : <has 'write', 'read', 'seek'>, ...): pass

    I'm not sure that makes a "type system".  Hmm.  More thinking
    required.

Not sure that makes a type system? Isn't that what the modern
understanding of a type is - a list of operations that are expected to
be supported, as with Java's idea of interfaces being distinct from
classes? I actually thought your example showed an interesting idea -
anonymous, defined-on-the-fly interfaces. (That is, if static typing is
wanted.)


Hamish Lawson


____________________________________________________________
Do You Yahoo!?
Get your free @yahoo.co.uk address at http://mail.yahoo.co.uk
or your free @yahoo.ie address at http://mail.yahoo.ie




More information about the Python-list mailing list