Longpython 17 Sep, 2006
I was recently introduced to the ‘longcat is looooong’ phenomenon which apparently has been going around certain forums for some time now. Here’s the Python version.
>>> import re >>> vowel = re.compile(r'^([^aeiou]*)([aeiou])(.*)$') >>> def longword(word): ... m = vowel.match(word) ... if not m: return word ... return m.group(1) + m.group(2) * 7 + m.group(3) ... >>> print longword('long') looooooong >>> def doit(noun, adjective): ... print adjective+noun, "is", longword(adjective) ... >>> doit('cat', 'long') longcat is looooooong
A more complete version, with doctests, is also available.