Python from Wise Guy's Viewpoint
Joachim Durchholz
joachim.durchholz at web.de
Thu Oct 23 07:51:20 EDT 2003
Pascal Costanza wrote:
> See the example of downcasts in Java.
Please do /not/ draw your examples from Java, C++, or Eiffel. Modern
static type systems are far more flexible and powerful, and far less
obtrusive than the type systems used in these languages.
A modern type system has the following characteristics:
1. It's safe: Code that type checks cannot assign type-incorrect values
(as opposed to Eiffel).
2. It is expressive: There's no need to write type casts (as opposed to
C++ and Java). (The only exceptions where type casts are necessary are
those where it is logically unavoidable: e.g. when importing binary data
from an untyped source.)
3. It is unobtrusive: The compiler can infer most if not all types by
itself. Modifying some code so that it is slightly more general will
thus automatically acquire the appropriate slightly more general type.
4. It is powerful: any type may have other types as parameters. Not only
for container types such as Array <Integer>, but also for other
purposes. Advanced type systems can even express mutually recursive
types - an (admittedly silly) example: trees that have alternating node
types on paths from root to leaves. (And all that without type casts,
Mum! *g*)
Regards,
Jo
More information about the Python-list
mailing list