Static typing

Tayss tayss_temp at
Sun Jul 27 15:37:09 CEST 2003

Bruno Desthuilliers <bdesth.nospam at> wrote in message news:<3f23ae06$0$21093$626a54ce at>...
> > FWIW, I do favor the addition of optional static typing for the two
> > reasons Scott described - interface documentation and optimization.
> Interface documentation may be obtained in others ways (docstring for 
> exemple).

Indeed!  As I remember, Jython uses doc strings for typing, when it
presents an API to Java.  So it's in the comments, and I think that's
an oddly appropriate place for hints to the compiler.

> And I'm not sure static typing would optimize anything, but 
> not being a Python (nor anything else) guru, I would not bet my hand on 
> this...

If you mess around with lisp, you can easily see the compiled assembly
language of your functions when you experiment with optional typing. 
(By calling the function "disassemble".)  Normally, the compiler spews
a lot of general code because it doesn't know what you've passed in. 
But when you promise that you're passing in numbers or something, the
assembly language is much tighter.

Sort of like when someone asks you to move something to a different
house, and you have no idea how big it is.  If you were told, "It's
just a pillow," you know that you don't need to order a huge truck or
take any special precautions.

More information about the Python-list mailing list