Typed Python?

Pierre-Frédéric Caillaud peufeu at free.fr
Mon Jul 5 09:21:29 CEST 2004

	Try numeric / numarray (optimized arrays/matrices of real/complex for  
scientific computing).

> Paul Prescod wrote:
>> To put it another way: Jarek complains that static typing would destroy
>> the "fun". I think he means Python's flexibility. A type inferencer
>> removes the need to declare types but a statically type-inferenced
>> language is still statically typed. It will still be strict about type
>> usage.
> 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.
> Cheers,
> f

More information about the Python-list mailing list