Thursday 24 March 2005 — This is over 19 years old. Be careful.
A thread on comp.lang.python asking about text-to-speech libraries turned into a call for Python limericks. The discussion meandered on for a while (let’s just say there’s a reason most of these people are engineers rather than poets), until Michael Spencer posted this piece of brilliance:
How about a category for executable limericks?
Here’s one to get the ball rolling:
# voice only the alphanumeric tokens
from itertools import repeat
for feet in [3,3,2,2,3]:
print " ".join("DA-DA-DUM"
for dummy in [None]
for foot in repeat("metric", feet))Michael
P.S. I know ‘three’ doesn’t rhyme.
Not only is the Python code itself in the form of a limerick, but if you run it, it prints this:
DA-DA-DUM DA-DA-DUM DA-DA-DUM
DA-DA-DUM DA-DA-DUM DA-DA-DUM
DA-DA-DUM DA-DA-DUM
DA-DA-DUM DA-DA-DUM
DA-DA-DUM DA-DA-DUM DA-DA-DUM
Genius!
Comments
from itertools import repeat
for feet in [3,3,2,2,3]:
print " ".join(["DA-DA-DUM"
for dummy in [None]
for foot in repeat("metric", feet)])
Add a comment: