There are many ways of using python with other languages. Depending on your choice binding will be more or less tight, and the communication interface will be more or less advanced, ranging from communcation through text strings to inheritance of Java or C++ classes.

  1. OS level calls
  2. XML and HTTP etc
  3. DLLs, DDE, COM and DCOM
  4. CORBA and friends
  5. Embedding and Extending Python
  6. shared tuple space
  7. JPython / Jython
  8. Related sites

OS level calls

The simplest way of making programs talk to each other is probably the Unix way of making programs work like filters that receive a text file, process it and produces a new file which is sent to the next program. The [WWW] Unix Philosophy explains the basic concepts, and sys.stdin, sys.stdout, os.system and os.pipe etc in the [WWW] sys and [WWW] os modules are your basic tools.

For instance, you can write like this:

import os, sys 
dirList = os.popen('dir '+' '.join(sys.argv[1:])).readlines()
for entry in dirList:
    print entry,

That will print a directory listing under Windows. NB! This is just a simple example, and you shouldn't really use popen for this purpose, since it is platform dependent. Use the os.listdir() function instead.

Or you can make a simple word counting program (just splitting on white space) like this:

import sys 
raw_text =
wordCount = len(raw_text.split())
print wordCount, "words counted"

Then you can type the following at the OS command prompt: *.* | to see how many words the directory listing contained (whatever good that will do you). Unfortunately, Windows (at least Windows 2000) is broken in handling filename-endings to run programs. So there you need to type: *.* | python instead.

Obviously this is a very loose coupling. The different progams need not know anything about each other except something about what the textual input looks like.

In Unix this way of working has proven very useful for decades. Other operating systems often lack the infrastructure for doing this well, but it seems both Mac OS (which is Unix based in version X) and MS Windows are incorporating more of this now.

XML and HTTP etc

XML isn't that different from the above. But with this standard for structuring text files, there are lots of tools that will help. Naturally XML can be used for OS level calls as above, but also for commuinication through the web protocol HTTP etc.

There are a lot of interesting things going on here. For instance

This list of articles might also be of help:

(Although it seems most SOAP projects have stalled. This might not be so strange, since it seems the big vendors of Web Services are more interested in locking in their customers in their own solution, than actually providing portability. (Have we seen this pattern before???))


With the [WWW] Win32 extensions you can communicate with other Windows programs through DDE, COM and DCOM, or through calldll, which is part of Sam Rushings [WWW] DynWin package. This is well described in PythonProgrammingOnWinThirtyTwo .

A new (2002) alternative to Sam Rushing's package is [WWW] ctypes.

For COMunication with .NET try [WWW] KOBRA or [WWW] Python Scripting For .NET.

CORBA and friends

There are several CORBA implementations and bindings for Python.

The official CORBA language mapping is available from [WWW]







[WWW] omniORBpy

Python bindings to the CORBA implementation omniORB

AT&T Laboratories Cambridge (Used to be Olivetti/Oracle Research Labs)

Active development



[WWW] ORBit-Python

Python bindings for ORBit, the Gnome orb

Jason Tackaberry, Roland Mas, Christian Reis

Active, slow development




The Inter-Language Unification system (ILU) is a multi-language object interface system. ILU can hide implementation distinctions between different languages, between different address spaces, and between operating system types. It can be used to build multi-lingual object-oriented libraries with well-specified language-independent interfaces, to implement distributed systems and to define and document interfaces between the modules of non-distributed programs. ILU interfaces can be specified in either CORBA IDL, or ILU's ISL. ILU 2.0 supports C++, ANSI C, Python, Java, and Common Lisp. Contributed support for Modula-3, Guile Scheme, and Perl 5.

Xerox PARC




[WWW] fnOrb

CORBA implemented in Python

University of Queensland in Brisbane, Australia

Project revived after open-sourcing in January 2002.

Python-like Open Source licence


[WWW] Scion

CORBA subset. Based on ILU and Python

Vladimir Ulogov




But note what JimFulton said in an [WWW] interview:

See also [WWW] and [WWW] . These articles might also be of help:

Now, there is also support for [WWW] XPCOM, the cross platform component object model of the Mozilla project.

There are also simpler systems for distributed computing with Python but these are not multi-language.

There is more at [WWW] Parnassus.

A CORBA competitor which is multi-language is [WWW] YAMI.

Another multi-language CORBA competitor which has Python bindings now (2004) is [WWW] ICE The Internet Communications Engine.

Embedding and Extending Python

Embedding Python in programs written in other languages, and extending Python programs with program modules written in other languages is described in the standard documentation:

It's also covered in PythonEssentialReference and for instance in an [WWW] IBM developerWorks article.

There are also a number of programs to make this easier (I've trimmed this down a bit...):








Connects C, C++, and Objective-C programs with a high-level languages such as Perl, Python, Tcl/Tk, Ruby, or Guile


Actively used and developed. Well documented.


SimplifiedWrapperAndInterfaceGenerator is probably the most widely used tool to assist extending Python with C or C++. It's basically a C tool, and doesn't fully support the features of C++ (templates, overloading?).


Part of PyQT/PyKDE, the tools to write Python programs for TrollTech's QT tool kit, and the K Desktop Environment (Linux GUI)

[WWW] Phil Thompson

Actively developed.


No documentation . Seems to be made specifically for Qt and KDE, but can be used for other things as well.

[WWW] Boost.Python

Reflects C++ classes and functions into Python. Part of [WWW] C++ Boost.

David Abrahams and others

Actively developed and documented.

Open source (Not GPL-like)

Looks interesting for extending Python with C++ modules. Good tutorial etc. Seems to become the standard for wrapping C++ in Python.

[WWW] Weave

The weave package allows the inclusion of C/C++ within Python code.

[WWW] SciPy project


Python style?

Weave is part of the larger SciPy package, but is made available here as a standalone package so that more people can try it out.

[WWW] Pyrex

Pyrex lets you write code that mixes Python and C data types any way you want, and compiles it into a C extension for Python.

Greg Ewing [MAILTO]

Active development (Version 0.4.5 in Oct 2002, in May 2004)

Copyright stuff: Pyrex is free of restrictions. You can use, redistribute or modify it however you want.

This is one of the really interesing new developments in Python.

[WWW] Psyco

Psyco is a specializing compiler for the Python language.

Armin Rigo

Beta version. Active development.

MIT License

Psyco actually turns a subset of Python into C and makes extension modules automagically. Currently only supports x86.

[WWW] Pyfort

Pyfort -- The Python-Fortran connection tool

PaulDubois and others



Pyfort is a tool for creating extensions to the Python language with Fortran routines. It supports F77-interfaced routines now, with plans for supporting more of F90 later.


Fortran to Python Interface Generator

Pearu Peterson

Beta version. Active development.


Pearu is also involved in SciPy.

This plethora of tools might seem a bit confusing, but it seems that the arena is clearing up a bit...

Want to wrap an exsisting C module? Use SWIG.

Want to wrap an exsisting C++ module? Use Boost. The [WWW] C++ SIG is focusing on Boost, and no alternative seems to have the same documentation and support.

Just want to improve performance? Maybe you should have a look at Weave, Pyrex or Psyco first? I guess at least one of them will disappear eventually, and that one of the others will become a standard way of speeding up Python code. Don't know which yet though...

shared tuple space

A [WWW] Tuple Space is a shared associative memory

Sun offers [WWW] JINI JavaSpaces, IBM offers [WWW] T-spaces and Ruby includes [WWW] Rinda

Python has [WWW] PyLinda and [WWW] Tripoli

JPython / Jython

Jython (previously called JPython) is a Python implementation written in pure Java. With Jython you can inherit Java classes in Python, write your Python GUI in Swing and run Python in your browser. Don't expect it to be blazingly fast though...

See [WWW]

There are also other ways of combining Java with Python. See [WWW] Parnassus.

Related sites

[WWW] IntegratingPythonWithOtherLanguages on the Python Wiki.

[WWW] UsingRubyWithOtherLanguages, [WWW] Tcl and other languages, [WWW] UsingLuaWithOtherLanguages.