BrianQ at ActiveState.com
Thu Aug 23 02:22:45 CEST 2001
> Python has been re-written into jpython in which the language
> parallels the java language. The main difference is java
> enforces strong type casting (which is good), where jpython does not
> (its a gimmick to not scare off non professional programmers who
> don't want to take the time to verify every line of code is type
> casted correctly (this is the part where I'll get beat up on) ).
Python is strongly typed. It is just that the type checking is done at
runtime rather than at compile time. Perl, OTOH, is weakly typed
because conversions are implicit at runtime.
Runtime typing can be immensely useful in real applications,
especially were proxying is involved. Imagine that you are doing some
work in XML and using various XML libraries i.e. minidom, PyXML,
Pyana, etc. Each of these has their own DOM implementation and none
share a common base class. In Python, they can all be used
interchangeably because their types are not relevant. They all
implement the same methods with the same semantics so they are
equivalent. In a static language, you would have to write code to
proxy between all of these DOM implementations (*). Painful.
* Java helps you out here a bit through their runtime reflection APIs.
But they are almost as cumbersome as just writing the proxy code.
More information about the Python-list