The State Of Python

Published by at

Steve adds to his pet Python project, muses on the learning curve involved and comments on Python's future.

The story so far(!): I've been a 'hobbyist' programmer, writing freeware and shareware for Psion palmtops and Nokia smartphones for the last 10 years. Most of this was in OPL, Psion's BASIC-like language, although with OPL not available as an option for Series 60 smartphones I've been forced to diversify a little. In this article, I wrote about my initial experiences with Python and passed on tips for others on getting started and on how to create standalone, professional-looking applications. My test case for this initial exposure to Python was my desire to create a music-related utility for myself, which I released as full working shareware, Musician.

Musician 1.7, written in PythonIt has now been a couple of months since this initial burst of enthusiasm and, leaving aside the fact that Musician has had tens of thousands of downloads and only one registration [ 8-( ], I wanted both to extend the program and also see if I could push further into the world of Python. My idea was to add a playable mini-piano to Musician, letting me pick out simple melodies and seeing how tunes from the printed page sound. On the face of it, it sounded ambitious, involving graphics to the screen and real-time keypress detection and sound playback.

Now, the fact that four hours after having the idea for extending Musician with a playable piano, I had it working and uploaded into a new public version speaks volumes about Python as a RAD (Rapid Application Development) language. It's true that my piano was something of a kludge in that each note is effectively just a different 1 beat MIDI file and I haven't used any animation of the keyboard, but the fact remains that I had the idea and implemented it incredibly quickly.

I have to admit that at one point in the four hours I had a little help at working out the syntax of code needed to display my keyboard image from the very responsive folks who hang around on the Forum Nokia Python discussion group. This forum is (in conjunction with Nokia's two .PDF files - APIs and tutorial) your first stop for researching code snippets and working round problems with Python.

However, and this is something of a big however, Python is not the new OPL. Yes, I know it was never supposed to be, but there are similarities (OpenSource, free, easy to get started with, tiny apps on top of a runtime) and the comparison is extremely tempting.

Musician 1.7, written in PythonOPL is immediately accessible to beginners, with a very gentle learning curve (external links: my online tutorial series and Ewan's book), a fairly gentle intermediate slope and a not too difficult advanced level, for developing commercial programs. Of course, OPL is also seemingly dead in the water as far as S60 is concerned and much of its functionality, which was cutting edge in its day, is in dire need of extension for use in modern multimedia smartphones.

Python has a similar learning curve for beginners, at least in terms of putting up 'Hello world' or typing in one of Jurgen Scheible's examples. The scary part is the intermediate level. Out of Musician's four hundred or so lines of code, there are at least forty of which I have no idea, absolutely no idea how they work. For Python afficionados reading this, I'm sorry, I confess all, my Musician application is a cobbled together mish-mash of a basic skeleton from Jurgen, some of my own ideas and original content, plus bolt-on code snippets from others to do specific things (such as put up a multi-line dialog or play a sound file or display an image). The problem is that Python's such a generic language, designed to work on any and every computer in a myriad of different scenarios. It's already large and varied enough, add in Forum Nokia's extensions for Symbian OS and Series 60 and then consider the fact that it's mind-manglingly object-orientated and thus often counter-intuitive to anyone brought up in the world of BASIC, and you've got a pretty fearsome mid-tier learning curve.

In the advanced tier, Python probably gets easier, as the concepts involved become second nature, although you then start to hit limits in the Python for Series 60 implementation.

Python logoNow, please bear in mind that I'm not trying to be negative here. I simply want to call a spade a spade and not get people's hopes up. Python is very interesting to play with and provides a working way to get your application ideas onto modern S60 smartphones, as I did. But don't expect to create everything yourself and maintain complete control. In the days of OPL, I would often start applications with a clean sheet of paper and craft them from the ground-up, akin to building with Lego. Programming with Python is more like getting a dozen boxes of Meccano, with hundreds of sections and components ready to use, and with the instructions split across 20 different booklets in different formats.

It's also worth noting that, despite the Forum Nokia hosting of the main discussion group,  the main Forum Nokia download page for the Python SDK still shows version 1.2 from October 2005, while the main OpenSource download page has been at v1.3.1 since January 2006. Not a huge problem in itself, but in the light of the push being given by Nokia to Flash Lite, it's a sign that Nokia don't really believe in Python and aren't investing significantly in its development. Will Python for S60 suffer a similar fate to OPL and get left behind due to lack of commercial investment? I really hope not.