Next: 5.1.2 Optimization
Up: 5.1 Advanced Compiler Introduction
Previous: 5.1 Advanced Compiler Introduction
Python's support for types is unusual in three major ways:
- Precise type checking encourages the specific use of type
declarations as a form of run-time consistency checking. This
speeds development by localizing type errors and giving more
meaningful error messages. See section 4.5.2. Python
produces completely safe code; optimized type checking maintains
reasonable efficiency on conventional hardware
(see section 5.3.6.)
- Comprehensive support for the Common Lisp type system makes complex
type specifiers useful. Using type specifiers such as or and
member has both efficiency and robustness advantages.
See section 5.2.
- Type inference eliminates the need for some declarations, and
also aids compile-time detection of type errors. Given detailed
type declarations, type inference can often eliminate type checks
and enable more efficient object representations and code sequences.
Checking all types results in fewer type checks. See sections
5.3 and 5.11.2.
Raymond Toy
Mon Jul 14 09:11:27 EDT 1997