First off I decided not to build a unit test set-up as we are talking about writing a single class (to do the mandelbrot) and the web handlers, in all its just under 5,000 lines of written code and comments. So how did I get on? The timings are of course approximate, all I did was note minutes of time spent
So what did this tell me? Well first off the things I like
Python has a Complex number type that made the mandelbrot code easier
The Templating engine that Google have included is easy to use
Otherwise this was a poor language learning experience for me. Sure there wasn't the complexity and raw anger that C seemed to demonstrate when I had 7 days to justify claiming in a stage 1 interview that I knew C. Python just seemed to have a lazy disdain for what I was doing. I was using the SPE editor and quite frankly it was less advanced than Emacs at giving decent language support. It doesn't do any checking of the code you are writing against the variables and functions that exist and doesn't do autocomplete on functions unless you type it in yourself. My person favourite was something called PyCheck which I assumes was meant to help me improve my code.... nice idea but probably a better one if it didn't have an error in it
I'm sure there must be better editors out there, but frankly SPE was like coding in VI but without the performance advantages.
Traceback (most recent call last):
File "/Applications/SPE.app/Contents/Resources/_spe/plugins/Pycheck.py", line 121, in OnProcessEnded
IndexError: list assignment index out of range
The common errors early on were around scoping. Having to do self."variable" was a bit unusual in an OO language but I soon got used to it. The truly awful thing however about Python is that it is an indentation sensitive language, which was a trick employed in the 1970s to make compiler writing easier and something that people came to dread with makefiles.
Thanks to a combination of the language and an editor that didn't help overcoming the language deficiencies the cycle was "write, run, check error log" the difference between this and the Java "write, auto-compile" and the "write, auto-highlight-error" approaches that I've been used to felt like a leap backwards into the land of C.
It wouldn't be fair for me to write a similar test using Java as I've been doing that for over ten years but what I would say is that after 7 days of learning C I then had 5 hours in which to write a fairly complex address book application. My first C++ programme was a distributed CORBA system and my first Java programme was an interactive VRML app. Python's productivity I would rate as worse than C++ as a development cycle and only above C++ overall due to its prevention of segfaults via a fairly reasonable exception and pointer strategy.
Before people leap forwards, the libraries are the things that make Python better for C++ for the web. The templating library Django was a better development environment that Python itself, I especially like they way they've limited it to only those things that make sense in a templating language thus making sure that you split out the view bits and the code bits. Even down to using "end" markers for loops and ifs because it can't rely on indentation just made it feel better and more stable than the programming language. This is certainly the first time I've ever felt that the templating environment was better than the coding one.
Python is a toy language. Its quite good to knock things up with and probably rewards people who are less structured in their approach. For myself however it was certainly not a productivity gain and I became thoroughly annoyed at a sequence of typo errors wasting minutes of time. Some people will leap up and say "well you can see the changes straight away" because as a scriptoid language Python is "dynamic" and the code changes are "automatically" applied. Errr but I do that in Java as well via an ant script so the fact that I don't actually have to run a bloody test to check a syntax or semantic error is a bit of an advantage.
Its really hard to see what the fanfare is around Python, its a scripting language, it uses indentation to indicate containment. With the largest proportion of my time spent in a break-fix cycle, most of which a decent compiler would have caught, this really doesn't scream to me a language of high productivity.
A better editor might have made the experience better and more effective, so any recommendations would be appreciated. I'm still playing with the App Engine so I can revise my thoughts.