Python On IBM i: Why?
Published: September 24, 2012
by Alex Woodie
Why might you want to run Python on the IBM i platform? According to the folks at iSeries Python who manage the port of the open source language to IBM i, Python is so readable and easy to learn that it gives programmers a big boost in productivity when they use it, particularly for reporting purposes. And with the recent completion of the port of the Django framework to IBM i, there is one more reason to consider adding Python to your quiver.
The iSeries Python project, which is the brainchild of Per Gummedal, began around 2004. Since then, Gummedal and a handful of programmers and administrators have worked to expand the use of Python on the platform, to explore new uses for the language, and to answer questions on the website's bulletin board.
One of iSeries Python's earliest users, Aaron Fransen, has been managing the website and its site on SourceForge for the last four years. Fransen, who is a programmer at an electrical wholesaler in western Canada, is also one of the biggest proponents of Python on IBM i, as he has witnessed firsthand the power it can bring.
"One of the wonderful things about Python is it's very capable built-in. There's not a lot of stuff you have to add to it," Fransen says. "Python started out as a means for teaching kids how to program, but it ended up being a very well-constructed, object-oriented, positional syntax language."
The positional nature of Python makes it easily readable and quickly understandable. "A lot of the idioms that Python uses aren't obscure like you would find in Java," he says. "It doesn't make heavy use of curly braces and colons and other things. You could write a formula in PHP or in Java that's 100 characters long and has two letters in it, and everything else is a curly brace or some of those special characters, but Python doesn't quite operate like that."
"Python tries very hard to make it very simple to follow, so at a glace, you can look at a Python program and know exactly where you are," Fransen continues. "Some programmers hate that. Programmers like me love it, because it means that if I haven't looked at a program in three years, I can go back and look at it, and within seconds I can follow the flow very simply and find out where I am in it."
The simplicity of the Python syntax and the comprehensiveness of its library combine to make for a very productive environment, and that productivity has led to some high-profile Python projects over the years. Google used Python for much of its early search engine code, while Walt Disney uses it for its production animation system. Much of the National Weather Service's website is written in Python, as was (until recently) NASA's scheduling system.
Python surged to popularity in 2007, when it first won the TIOBE Index's "Programming Language of the Year" award, which it won again in 2010. Currently, Python is ranked the eight most popular language in the world, behind stalwarts like C, Java, Visual Basic, and PHP (but ahead of COBOL and RPG, which are 25th and 28th, respectively).
Most iSeries Python projects today fall into one of two categories: reporting and communications. The iSeries Python website also has lots of example code for accomplishing other tasks with Python and IBM i, including data access, "pickling" between EBCDIC on the IBM i and ASCII on PC platforms, sending email on the IBM i server with Python apps, printing reports, and using ADO to query data on the IBM i server.
Getting another reporting tool was the main reason that Gummedal initially ported Python to the iSeries (as it was called back then), Fransen says. "If you don't want to have to learn RPG on the iSeries, it's a great way to be able to run some reports, and it's super simple to maintain them," he says.
Gummedal began using iSeries Python to provide connectivity between his company's IBM i-based ERP system, the D3 system from CAPP Associates, and an external source of data. "It's useful if you happen to have some legacy functions that you can't get around," he says. "In our case, our ERP is iSeries-based and we wanted to take advantage of some of the functionality we have on our website. Our Web repository, which runs on MySQL and Apache, has scads of data, and it was simply more convenient to grab it off the Web than to have to recreate that data in the iSeries."
Fransen doesn't have a solid estimate on the number of iSeries Python users that are out there. Such is the case with open source projects, where the bytes flow free and the licensing is non-existent. Fransen initially said there might be dozens of active users out there, but after checking the website logs and finding there were 70 downloads of the iSeries Python software in the last month, there's a good indication that the number could be considerably higher.
The iSeries Python board is quite busy, which is another indication of healthy activity. One of the recent pieces of product news to come out of the project was the availability of the Django Python framework on the IBM i platform. Django was initially developed by an online-news operation to host a high-performing and elegant-looking website. It is now available for the IBM i platform, providing a structured way to develop Web applications on the IBM i server.
Python doesn't have any official backing from IBM, which is ironic in a way, because the IBM website has a lot of sample Python code. "IBM has significant references [on its website] for different technical challenges that they've resolved in Python," Fransen says. "But they're doing it from a Windows or Unix standpoint, not from the iSeries standpoint."
That shouldn't stop the intrepid IBM i developer from utilizing Python on the platform to tackle problems or develop new apps. The language is very easy to learn, and delivers new applications very quickly, for those willing to take the plunge.
"I learned it [Python] in a day, and I'm not the world's brightest fellow," says Fransen, a self-deprecating programmer who's background is Assembler and Basic. "Anybody who's reasonably familiar with Basic will understand Python syntax very quickly. Folks who are immersed in PHP or Java will probably have a little bit of trouble at first with the formatting. But once you get used to it, it's very comfortable."
An Introduction to Python on IBM i, Part 3
An Introduction to Python on IBM i, Part 2
An Introduction to Python on IBM i, Part 1
Next Up on the System i: Python
Post this story to del.icio.us
Post this story to Digg
Post this story to Slashdot