Last weekend, I worked all night programming a random player for a programming contest. Things like this always turn out to be harder than expected. Elegant code, nice class dependencies, doctests, Python 2.4.
Results: errors. It turns out the contest sandbox runs Python 2.2. I’m not complaining, host Fred is limited by his hosting provider. Hey, this is the real world. Some companies do use almost 4 year old versions1.
Ok, maybe I shouldn’t have used
for move in moves[::-1]: yield move
But did you know built-in function sum(seq, start=0) was introduced in Py 2.3.5?
return sum(scores) NameError: global name 'sum' is not defined
You live, you learn.
Check my position, second last. But tonight, my random player will get lucky. I just submitted my 4th version, this time tested with Py 2.2. Good night!
1) Red Hat Enterprise servers, for example.