Type Hinting vs Type Checking and Preconditions

Tom Bradford bradford653 at gmail.com
Wed Mar 8 09:34:34 EST 2006


Really what we're talking about here is weak typing in the form of
optional type hinting performed on a function by function basis.  As an
option, what it would do is allow an author to semantically 'hint' to
the interpreter that a function is expecting a certain type, and
perform any implicit conversion if the passed type is not what was
expected, thus translating to a semantically expected result.

It is my feeling that this doesn't represent a sea-change in the way
Python does things, and it's certainly *not* the way things are done in
Java or C++, as both of those languages are strongly typed, wherein you
can't even pass a parameter if it isn't of the expected type, or a
subclass thereof.

The fact is, that with a system such as this, you could just 'not use
it', and none would be the wiser, as it's an authorship extension
rather than a calling extension.  What I was suggesting is that nothing
change other than function/method prototypes, and that everything,
everwhere, at all times continues to be represented as scalars.




More information about the Python-list mailing list