Proposal: local variable declarations and type advice

logistix logstx at
Tue Feb 26 23:50:50 CET 2002

> Of course it's possible in a dynamic language, and it helps compilers.
> Lisp compilers have worked that way since the 60's or even earlier.
> Obviously that example can't be checked statically by the compiler.
> It can be checked dynamically at runtime (debug mode) or the compiler
> can generate code that assumes the advice is correct and which crashes
> if the advice is wrong (optimized mode).

Okay, I exaggerated, it is possible to type in a dynamic language if you
don't mind increasing the number of opportunities for the program to crash.
I'd say 98% of the Python community is probably more interested in REDUCING
the number of crashes than a potential speed increase (especially since
there's not even a native compiler to optimize yet)

> Why would I want to use the builtin type() function everywhere I want to
> validate the type, if Python can do the check for me automatically based
> on the type advice?

Why would you change the entire semantics of the Python language just so
that you can do something in one line of code that can already be done in
one line of code?

More information about the Python-list mailing list