David Mertz interviewed Jpython and Python for. NET developer Mark Hammond, Finn Bock and Barry Warsaw. He learned from Mark about the latest scoop on Microsoft's development (all of which is within the confidentiality limit) and learned from Finn and Barry about the Jpython and the Jython projects they will release.
Although Python is usually synonymous with CPython, its specifications have been implemented many times in other places, including in applications for Java and. NET. Jpython compiles the Python source code into Java bytecode and provides transparent access to Java classes. Python for. NET is an application of Microsoft's upcoming cross language technology platform. During interviews with Mark Hammond, Finn Bock, and Barry Warsaw, I found more information on how Jpython and Python for. NET were developed, and how to prepare for these alternative Python implementations in the future.
Python for. NET
Thanks to the excellent development of pythonwin environments and pythoncom extensions, Mark Hammond is well known to the vast majority of Python programmers. For the same reason that we admired Mark, Microsoft also valued him very much. They decided to turn to him for help on the Python for. NET implementation. According to Mark, the working version of Python for. NET should be available soon, and now you should be able to get its alpha or beta version from ActiveState (see Resources).
David Mertz: What exactly is Python for. NET? I think what I'm particularly interested in is the relationship between Python for. NET and your own Pythonwin and pythoncom extensions to CPython, which seem to control the internals of Windows.
Mark Hammond:python for. NET is a compiler and runtime that implements the Python. NET platform on Microsoft's. NET platform provides a run-time and metadata system designed to allow complete language interoperability, but to do so, The language must be able to be used in the runtime.
For example, if the Python class is public so that Visual Basic programmers can inherit it, the Python class must be implemented and described in. NET terminology rather than in cpython terms.
The advantage of Python. NET is that it can interoperate with the. NET Framework. There are still many flaws, mainly due to the immature implementation. But it's really just a matter of time. We are still in the beta phase of development and commissioning.
Mertz: What do you think of the incompatibility between today's Python for. NET and CPython?
Hammond: Yes, most modules have not yet been implemented, so the existing modules written in C cannot be used exactly. If your goal is not the. NET Framework, it is best not to use Python. NET at this point.
Mertz: However, Python for. NET certainly has some key advantages, such as convenient communication between languages and multilingual application development. But why do you say better than the ones you already have-for example, Python+c+swig (assuming, of course).
Hammond: As far as Python+c+swig's current development is concerned, it should be obvious. Inter-language calls should never be as difficult as using Python+c+swig. But SWIG is a great product in many other ways. It uncovered the mystery of the Python C extension and only put it in the difficult ranks.
It is more reasonable to compare. NET with COM or Corba. Both COM and Corba provide cross language calls to "in-place" solutions without any manual involvement or compilation.. NET takes it one step further and provides cross language inheritance and exception capabilities. These benefits are very similar to those found in the multilingual implementation of Java virtual machines.
Mertz:python for. NET compiles a Python script into the format of an external virtual machine. Do you think that the. NET VM will support some exotic features of stackless and vyper, such as continuity, builder, collaboration, tail recursion, or deferred evaluation?
Hammond: Yes, theoretically it will. But some of the terms of the Microsoft Beta deal don't allow me to talk about performance issues. Let's target only those features defined in the core Python language reference. The collection of unwanted information is inherited, as in Jpython and JVMs.
Mertz: Next, on the policy theme, why do you think Microsoft is doing the development work of Python for. NET?
Hammond: You can use Python for people who choose target. NET. Microsoft has long been determined to participate in Python and many other languages to make sure that their VMS do not understand the language and can use it. Based on feedback from various language implementations, they have now made a number of changes to their VMS.