Adding static typing to Python

Chris Gonnerman chris.gonnerman at newcenturycomputers.net
Wed Feb 20 07:57:16 EST 2002


----- Original Message -----
From: "Alexander Jerusalem" <ajeru at vknn.org>


> That's obviously not the opinion of the members of the "The Python
> type system SIG" including Guido van Rossum, otherwise they wouldn't
> consider adding static types as an optional feature.
>
> Alexander
>
>
> Daniel Klein <danielk at aracnet.com> wrote in message
news:<55367u4imqamlmv8ou707t40dk1jolrkmc at 4ax.com>...
> > The point is that it ceases to be the same language with the same
attractions
> > (or flaws) depending on how you look at it.
> >
> > Dan

Static types as an optional feature for function/method interfaces is
not a bad thing, and does not really change the language; but the key
word here is "optional."  If static typing of function arguments is
optional, I for one am not likely to use it, so the language hasn't
changed.

Making it mandatory, now, THAT changes the language.

Static typing of *all variables* (destroying type inference and
incidental generality) is another beast entirely; but if it were
possible without killing performance (for I'm not sure that it
would actually improve performance after all), if it's optional
then nothing is harmed.

Static typing is used by compilers to improve performance, I'm told;
but to do it with an interpreter would require implicit typechecking
by the interpreter core.  This would probably be faster than explicit
typechecking (as in, write it yourself) but I can't help but see it as
a performance loss vs. the usual method (no typechecks at all,
exceptions thrown for interface mismatches).






More information about the Python-list mailing list