PEP 3107 and stronger typing (note: probably a newbie question)

Robert Brown bbrown at speakeasy.net
Fri Jun 22 00:57:34 EDT 2007


Stephen R Laniel <steve at laniels.org> writes:
> Granted, in a dynamic language we won't always (maybe "won't
> often") have a situation where the types are known this well
> at compile time. But sometimes we will. And it would be nice
> to catch these before the program even runs.
>
> So my question is: would bolting on "static type checking
> when we can, no type checking when we can't" be too much
> to ask?

Common Lisp allows the programmer to optionally provide type declarations to
improve readability or performance.  Certain implementations of Common Lisp,
such as cmucl and sbcl, check type declarations at compile time, employ type
interence to generate efficient machine code, and insert run time checks
when the compiler can't prove at compile time that variables have their
declared types.



More information about the Python-list mailing list