Typed Python?

Paul Prescod paul at prescod.net
Tue Jul 6 16:36:56 CEST 2004


Brett C. 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.
> 
> 
> This is not necessarily true.  While this is how Standard ML and
> friends use it, this is not how Python would use it.  Type inferencing
> can be used to infer types purely for performance reasons.

Well, yes, of course. But in the context of a question about STATIC TYPE 
CHECKING as opposed to: "Wouldn't it be great if Python were higher 
performance" I felt obliged to point out that there is no free lunch. 
The original poster asked for a steak with the consistency of fish and 
the flavour of bubble gum ice cream and they aren't going to get it: not 
from Starkiller, not from Haskell and not from Python 3000.

>...
> And as just a general comment, type inferencing in Python without
> changing semantics is **very** limited.  

Right: and that's for performance reasons, not correctness reasons. 
Think about how much the semantics would have to change to be able to 
help with type correctness reliably.

  Paul Prescod





More information about the Python-list mailing list