dive-into-python3/generators.html at master · kennethreitz-archive/dive-into-python3 · GitHub
dive-into-python3/generators.html
419 lines (345 sloc)
40.274 kB
def plural(noun): <a> if re.search('[sxz]$', noun): <span class=u>&#x2460;</span></a>
return re.sub('$', 'es', noun) elif re.search('[^aeiou]y$', noun): return re.sub('y$', 'ies', noun) else:
<pre class=pp><code>def plural(noun): if re.search('[sxz]$', noun): <a> return re.sub('$', 'es', noun) <span class=u>&#x2460;</span></a>
return re.sub('y$', 'ies', noun) else:
def plural(noun): <a> for matches_rule, apply_rule in rules: <span class=u>&#x2463;</span></a>