Python limericks (was Re: Text-to-speech)

David Fraser davidf at sjsoft.com
Wed Mar 23 03:14:49 EST 2005


Michael Spencer wrote:
> How about a category for executable limericks?
> 
That was my thought too...

for programmer in search_of("elegance"):
   if programmer.needs("an experience"):
     print "whitespace counts much"
     if Van_Rossum is Dutch:
       print "Dictators are made by benevolence"

And an attempt at a self-replicating one that uses far too many 
syllables in the last line:

rhymes = 'for line in ["rhymes", "fines"]:\n '
fines = 'print line, "=", `eval(line)`\n'
for line in ["rhymes", "fines"]:
   print line, "=", `eval(line)`
whine='whine=%s;print rhymes, fines, whine%%`whine`';print rhymes, 
fines, whine%`whine`

This can actually be pronounced as a proper limerick as follows: always 
pronounce = as "is" and ; as "so", don't pronounce any other 
punctuation, and cheat by pronouncing the first string in the last line 
as "junk" :-)

rhymes is for line in rhymes fines
fines is print line is eval line
for line in rhymes fines
   print line is eval line
whine is junk so print rhymes fines whine whine

David



More information about the Python-list mailing list