Could Python supplant Java?
roy at panix.com
Thu Aug 22 08:21:47 EDT 2002
Paul Foley <see at below.invalid> wrote:
> SomeType foo(A x)
> there is no way the compiler can tell at compile time whether x.bar is
> going to be A.bar or B.bar at run-time -- it depends on the caller!
To make Paul's point even stronger, it not just depends on the caller,
but it may depend on run-time events. Imagine something like the
following (with A and B classes as Paul described them):
if randint(0, 1):
if you then did:
x = myFactoryFunction()
which version of bar() should get called is truly random and only known
at run time.
More information about the Python-list