Article of interest: Python pros/cons for the enterprise

Paul Rubin http
Mon Feb 25 16:18:18 EST 2008


Robert Brown <bbrown at speakeasy.net> writes:
> > Python's dynamic typing is just fine.  But if I know the type, I want
> > the ability to nail it.  ...local variables, arguments, return values,
> > etc  And if I don't know or care, I'd leave it to dynamic typing.
> 
> This is the approach taken by Common Lisp.  Often just a few type
> declarations, added to code in inner loops, results in vastly faster code.

That is just a dangerous hack of improving performance by turning off
some safety checks, I'd say.  Static typing in the usual sense of the
phrase means that the compiler can guarantee at compile time that a
given term will have a certain type.  That can be done by automatic
inference or by checking user annotations, but either way, it should
be impossible to compile code that computes improperly typed values.
Lisp and Python don't attempt to make any such compile time checks.
They check at runtime, or (in the case of Lisp with the checks turned
off) they don't check at all.



More information about the Python-list mailing list