Faster Python grabs programmers

Faster Python grabs programmers

A new version of the open source programming language called Python will be faster and help ease system administration tasks, advocates claim.

'The biggest new feature we saw was increased speed,' said Martin Hudson about Python Version 2.4, released earlier this week. Hudson is chief technical officer and vice president of Development InfoStructure, an Arlington, Va.-based IT consultant that has used Python to build applications for the General Services Administration, the Labor Department and the U.S. Agency for International Development.

The new version of Python includes a new module that allows system administrators to use small Python programs instead of shell scripts, said Michael McLay, a consultant who is the resident Python expert for the nonprofit Center of Open Source and Government. Shell scripts, written to execute routine system administration tasks, have more security vulnerabilities and offer less feedback when errors occur, McLay said.

'One of the really wonderful things about Python is the exception-handling mechanism,' McLay said. 'Instead of handling silent errors, you have a much richer environment to script the start-up and shutdown of applications.'

According to adherents, Python tends to be easier to use than full-fledged object-oriented languages such as C++ and Java, thanks to an easily readable syntax and greater flexibility in declaring data types.

In 2001, the Labor Department commissioned Development InfoStructure to develop, in 60 days, a Web content management system for its site. The company used Python to add new features such as version control to the open-source Zope content management software. Because of Python's ease of use, five developers working half to full time got the system running within two weeks, according to the company.

Such ease of use comes with a price, however. Finished Python programs may run slower than ones written in other languages. Python is an interpreted language, meaning Python programs are not compiled, but instead run directly from the source code. Eliminating the compiling process can slow the execution of the finished program, however.

To make version 2.4 faster, the Python development team rewrote portions of Python in the C programming language, according to Hudson. Now, with its quicker response times, Python can be used to tackle larger projects.

The speed of the Python interpreter was a concern for J.D. Doak, a programmer at the Energy Department's Los Alamos National Laboratory. However flexibility turned out to be more important, Doak said earlier this year at PyCon 2004 in Washington.

Doak said he used Python to write a program that would simulate environmental conditions within a nuclear fuel processing facility. The laboratory offers the tool to companies developing such facilities so they can track the volume of materials that might pass through the buildings.

Commercial simulation tools did not work well, according to Doak, because the program had to model multiple interconnected processes. What's more, facility designers extensively refine their models, and doing so with commercial tools could be tedious.

Doak wrote his program from scratch, using Python and a Python extension called SimPy, which offers simulation features.

At first, Doak was worried a Python-based program would not run simulations quickly enough, however he found performance to be acceptable. Using his program, a yearlong simulation was completed in a minute when run on a 1Ghz commodity server running Linux in 256M of RAM.

Doak admitted that commercial applications 'might be a little bit quicker than Python,' but added that 'the thing we lose [with the commercial programs] is the ability to make changes quickly.'

Now with Python 2.4, such programs may run a little faster.

About the Author

Joab Jackson is the senior technology editor for Government Computer News.


  • Records management: Look beyond the NARA mandates

    Pandemic tests electronic records management

    Between the rush enable more virtual collaboration, stalled digitization of archived records and managing records that reside in datasets, records management executives are sorting through new challenges.

  • boy learning at home (Travelpixs/

    Tucson’s community wireless bridges the digital divide

    The city built cell sites at government-owned facilities such as fire departments and libraries that were already connected to Tucson’s existing fiber backbone.

Stay Connected