Typed Python?

Jacek Generowicz jacek.generowicz at cern.ch
Mon Jul 5 13:14:53 CEST 2004

Fernando Perez <fperez528 at yahoo.com> writes:

> I am one who would really like _optional_ static typing information
> to be available in python, but for different reasons than the
> usually requested here: performance.  My field is scientific
> computing, and when you are inside a simple for loop, manipulating
> arrays of homogeneous data, the overhead of python's dynamicism is a
> killer.  Obviously what ends up happening is that we rewrite those
> parts of our codes in C/C++/Fortran, but it would be great to be
> able to simply tell python the types of the variables and have it
> not do any of its dynamic runtime checks.
> I do not believe in static typing as a compile-time 'feature': I've
> grown to feel that all the supposed benefits of static typing can
> indeed be achieved with proper testing, and the _huge_ gains in
> flexibility and productivity one gets from python's type model are
> something I don't want to do without.
> But for tightly constrained code that needs to run as fast as
> possible, without repeating any unnecessary work (such as type
> detection), having an option to declare type information would be a
> huge boon.

I guess that you know that this sort of thing is successfully done in
Common Lisp (and Dylan and probably some, if not all, Schemes).

I've even heard rumours of Guido saying that something like it will
appear in a future, Python.

I would certainly warmly welcome it, if it should arrive in Python.

More information about the Python-list mailing list