Python -- Use with both COM & Java?

Alex Martelli aleaxit at
Tue Jul 3 10:15:54 CEST 2001

"Howard Dunlavy" <howard at> wrote in message
news:Jpc07.289$GI4.22690 at
> This question may be way off base, but here goes anyway...
> Would it be possible to maintain one set of Python code that would run in
> both a Microsoft COM environment and a Java environment -- both natively?

Yes, if you constrain that set to simple-enough operations.
For example, a script made up of
    print "hello world"
would satisfy such constraints:-).

> Our situation is that we are currently using Delphi and WebHub in our web
> applications.  However, as we talk to more of our larger customers, they
> falling into either the native Microsoft camp (IIS, COM, MTS) or the
> Java world.  We had been trying to bridge this problem by using SOAP as
> RPC.  However, since we actually have to install our software (we are an
> ISV) at our client site, they would prefer software that would live in
> respective "worlds".
> Hence my question.  Is Python something that could be used to create both
> COM object and EJB's, for instance (using JPython).
> Any comments would be appreciated.

Seriously: you can (and should) isolate the system dependencies in
separate modules.  "import foo" will import different modules
(or packages etc) depending on the environment.  The 'business logic'
part can be unchanged, but there's no way to avoid the two separate
implementations for the 'technology-infrastructure access' part.

> I realize that this approach might be the "worst of both worlds", and it
> would probably make sense for us to pick one world or the other, but I am
> concerned that we are going to shut ourselves out of a major part of
> by choosing just one of MS or Java.

A perfectly understandable concern!


More information about the Python-list mailing list