With all the attention focused on Java and C#, companies may be missing out on a programming language that might be better suited to their needs. That language is called Python.
In technical terms, Python is a high-level, open source programming language that promises rapid development and a low barrier to entry for non-programmers. In other words, it is relatively easy to learn and use — no small feat for a programming language. But can it crack the enterprise market?
What’s in a Name?
Python stands out in many ways, not least because of its unusual name. While many programming languages have dull names like C, FORTRAN or ADA, “Python” is an attention-getter.
Like Linux, Python was first released in 1991. Guido van Rossum, the creator of Python, took a different approach to naming his creation. Instead of naming the language after himself, he took the name from legendary comedy troupe Monty Python’s Flying Circus.
Twelve years later, Python is going strong. It is a true cross-platform, object-oriented language with implementations on Windows, Linux, Mac OS X and many other platforms. In fact, van Rossum, now the director of PythonLabs at Zope Corporation, told NewsFactor that few OSes lack a Python implementation.
“It’s been ported to IBM (NYSE: IBM) mainframes, and there’s a version for the PalmPilot — Pippy,” he said. “I think there’s currently no decent version for Windows/CE, Microsoft’s (Nasdaq: MSFT) miserable handheld offering, although there was one a few years ago.”
Python is an interpreted language, which means developers do not have to compile an application to test it. Also, with some caveats, an application written in Python should run equally well on any platform without much of a problem.
David Ascher, a senior developer at ActiveState, which sells development tools for Python, told NewsFactor that Python applications that do not rely on platform-specific libraries should be quite portable. “Most programs don’t need to deal with platform-specific libraries, and work fine,” he said. “The biggest issues people face are fairly shallow, like Unix users not thinking that directories can have spaces in them, that sort of thing.”
Rossum agreed that most cross-platform issues can be tackled with a little effort. “The usual things differ like filename syntax, process management and GUI toolkits,” he explained. “You can do all those things in a Python subset that’s purely portable, although you have to make a bit of an effort.”
Of course, developers do need to be aware of their limitations. “Some facilities are just not available on all systems,” van Rossum noted. “The ‘Windows registry’ only exists on Windows, and ‘fork()’ only exists on Unix and Linux, but it’s easy to skip code that’s not applicable for a particular platform.”
According to van Rossum, Python is even better in some respects than Java or C for portability. “The situation is actually better than for Java, which in some cases simply denies access to OS facilities because they can’t be done portably. And it’s also better [than] for C, where all but the most trivial programs end up riddled with platform-specific #ifdefs.”
Not So Complex
Another one of Python’s attractive features, particularly to those who are not professional developers by trade, is its relative lack of complexity compared with C++ or Java.
One reason why Python is simpler than C++ is its approach to memory management. Ascher said Python developers do not need to consider this aspect of the technology. “Like Java, Python takes on memory management duties, something that the C++ programmer spends a huge amount of time thinking about,” he explained.
Ascher also said the development cycle for Python is much different. “Unlike both Java and C++, Python allows for a more exploratory style of development. It has a very quick edit-and-test cycle, and interactive tools that let you try things out very, very quickly.”
According to van Rossum, using Python means that a programmer needs to write fewer lines of code. “Python’s ‘primitive’ operations are much more flexible and powerful than those in most other languages, and as a result, you have to write fewer lines of code to accomplish the same programming task — often between two and five times less, sometimes even more. Programmer productivity is still pretty much tied to the size of the program source code, so reducing the code size makes a huge difference.”
The Limits of Python
Of course, no language can do everything well. Although Python is seen as a great choice for rapid development of GUI (graphical user interface) applications and Web programs, there are still some limitations on what it can accomplish.
For example, van Rossum said Python is not well-suited for “device drivers, operating systems, real-time MPEG decoders, that sort of stuff.” However, he added, Python can be combined with other languages to improve performance. “Many performance-critical applications have been completed successfully in a mixture of Python and C, where only a few selected critical parts were coded in C or C++.”
For his part, Ascher said he would not use Python for “real-time applications, deep integration with .NET … and [in] some high-performance computational problems, although in some others it shines.”
Working in Tandem
When Python cannot do the job alone, Ascher noted, a developer can always pair it with another language. “[Python] integrates very well with C, C++, FORTRAN and Java. In fact, most of the high-performance Python codes will delegate the grunt work to a C, C++ or FORTRAN library, thus combining the efficiency of those languages and reusing existing codes, while still being in a flexible and dynamic environment which lends itself to rapid program evolution.”
He said the merger of Java and Python is particularly powerful. “There is a version of Python written in Java, Jython, which automatically gives users the ability to treat Java class libraries as if they were Python libraries, and vice versa. Jython is an excellent complement to Java, especially for prototyping and testing of Java applications.”
Jython is similar to the Python implementations written in C for Linux, Windows and other OSes, except that it is written in Java — allowing the user to run a Python application on any Java platform.
Where Python Fits
Overall, the areas in which Python is not suitable are far outnumbered by those areas in which it is a good fit.
What kinds of applications might an IT employee want to develop in Python? Just about anything, according to Ascher. “Python is well suited for everything from small throwaway scripts to large system development,” he said. “It shines in the areas of rapid development, network programming, computational steering and algorithm-heavy problem solving.”
One example of Python in action is the Zope Web application server. According to van Rossum, Zope is written almost entirely in Python. “We write all layers of our Web content management applications in Python, except the lowest-level data structures,” he explained.
In practice, the language is used in a wide variety of applications, from small-scale projects to more difficult endeavors like game programming. For example, Python is used in the Apache Toolbox, an application that simplifies compiling Apache from source, in the Oak DNS server, and in many other applications, ranging from the simple to the complex.
Who Is Using It?
Python is particularly of interest for people who need to solve computing problems but are not full-time developers. Ascher noted that scientists favor Python because it allows them to see their projects through to completion. “Scientists gain massive control over their own research because they can control their experiments and analyses without having to talk to a ‘professional programmer’ and explain what they want done,” he said, adding that “Python is very successful in the computational steering arena, whether that’s to do weather forecasting or theoretical physics.”
Van Rossum agreed. “Python is remarkably popular with people who aren’t full-time programmers, like myself, but who are scientists, educators, business people and so on, who find that they occasionally need to program a computer. With Python, they find that they can do it themselves much more quickly than they could have it done by a professional programmer using C++ or Java.”
Charming the Snake
If Python is so popular among non-programmers, does that mean professional coders will dislike the language? Not at all. In fact, Ascher said, C++ and Java programmers likely will find it easy to learn Python. “People who are competent in languages like C++ or Java typically find learning Python close to trivial,” he elaborated. “In my training days, I would find that the best students had a solid grasp of the language after a couple of days of studying it, and average students were comfortable at the end of a week.”
More importantly, Ascher said, one need not be a Python guru in order to put the language to work in useful ways. “Python is a very easy language to learn ‘a bit’ of. After an hour of running through the tutorial, you can get simple things done. There is no real learning curve as long as you’re familiar with standard programming concepts.”
Overall, then, it appears that Python is a mature language with implementations available for all widely used platforms. It is well suited for a variety of applications, and can be used by developers and non-developers alike. Given all of these advantages, Python should prove popular with businesses striving to produce cross-platform applications while saving money on development costs.
(Originally published on NewsFactor.com/OSOpinion, rescued from the dustbin by Archive.org. Re-posted here mainly for nostalgia purposes and posterity.)