Could Python supplant Java?

Roy Smith roy at
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 is
> going to be or 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):

def myFactoryFunction():
   if randint(0, 1):
      return A()
      return B()

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 mailing list