Static typing in py [was Re: Some notes]

Ville Vainio ville at
Wed Oct 13 08:59:28 CEST 2004

>>>>> "Josiah" == Josiah Carlson <jcarlson at> writes:

    >> - The optional static typing seems a quite nice thing (for
    >> compilers too, they can produce faster code. It can probably
    >> allow faster and smaller arrays, like those of numarray).

    Josiah> Asking for static typing in Python is a pretty big
    Josiah> request.  It seems from those responses to similar
    Josiah> questions, the answer is simply "static typing isn't
    Josiah> coming to CPython any time soon, probably not even for
    Josiah> Py3k".

Guido has repeatedly expressed that Python will probably get optional
type declarations in the future. I am not sure to what extent that
implies static typing, but it's definitely on the map.

Boo already has type declarations, and I imagine the CLR
implementations of python (IronPython, Boo) will benefit most from
type declarations, performancewise. The benefit to CPython might be
more indirect, simplifying the work done by things like Psycho. Still,
I see type declarations opening so many doors that they should be in
the language - even if the performance improvement is zero at the
first stage. Python is not just CPython these days.

    Josiah> Keep wishing, but unless you implement it, I wouldn't get
    Josiah> my hopes up.

Implementation can be trivial - the interpreter could just assert
isinstance when check_type_declarations is true. The harder part is
coming up with all the semantics.

Ville Vainio

More information about the Python-list mailing list