The Model Programmer Pythonical

Words by Stephen Hawkes and Nicholas H.Tollervey

This work is licensed under the Creative Commons Attribution-NonCommercial-ShareAlike 3.0 Unported License. To view a copy of this license, visit http://creativecommons.org/licenses/by-nc-sa/3.0/ or send a letter to Creative Commons, 444 Castro Street, Suite 900, Mountain View, California, 94041, USA.

To the tune of "The Major General's Song" from Gilbert and Sullivan's operetta "The Pirates of Penzance":

Verse 1

[Solo]
I am the very model of a  programmer Pythonical,
I don't use C or PERL or PHP (they're quite moronical),
I much prefer the scope of code determined indentational,
In a language that has objects and is also very functional;
I'm very well acquainted, too, with matters that are scriptable,
I understand the Zen of Python makes my code maintainable,
Without the tests based on the specs it's hard to write some code that flows,
Namespaces are one honking great idea, lets do more of those!

[Chorus]
Namespaces are one honking great idea, lets do more of those! [x3]

[Solo]
I'm good at yielding stuff that makes my function generatable,
I create classes that are nice and easily inher'table,
But still in matters programmable, functional and logical,
I am the very model of a programmer Pythonical.

[Chorus]
But still in matters programmable, functional and logical,
[S]he is the very model of a programmer Pythonical.

Verse 2

[Solo]
Use *print* to output data that is character or numeral,
And *if* evaluates the objects boolean and logical,
Or *else* branch off to run a block of code when false is provable,
*elif* conjoins *if* statements making linked up tests more possible;
*for* iterates through items in an object that is iter'able,
*continue* skips an iteration making loops amenable,
*break* jumps the loop to let you shoot for something quite spectacular,
And *while* controls the flow, creating code blocks often circular.

[Chorus]
And *while* controls the flow, creating code blocks often circular. [x3]

[Solo]
With distutils it is a breeze to make my code installable,
Despite the fact that Py P. I. is often not contactable,
But still in matters programmable, functional and logical,
I am the very model of a programmer Pythonical.

[Chorus]
But still in matters programmable, functional and logical,
[S]he is the very model of a programmer Pythonical.

Lilypond source files to generate a PDF of the musical score and associated midi file can be found in the src directory.