Eduardo Vieira eduardo.su...@gmail.com wrote
def build_match_and_apply_functions(pattern, search, replace):
def matches_rule(word):
return re.search(pattern, word)
def apply_rule(word):
return re.sub(search, replace, word)
return (matches_rule, apply_rule)
patterns =
On Fri, Feb 12, 2010 at 11:49 PM, Eduardo Vieira
eduardo.su...@gmail.com wrote:
Hello! I was reading the latest version of Mark Pilgrim's Dive into
Python and am confused with these example about the pluralization
rules. See http://diveintopython3.org/examples/plural3.py and
Hello! I was reading the latest version of Mark Pilgrim's Dive into
Python and am confused with these example about the pluralization
rules. See http://diveintopython3.org/examples/plural3.py and
http://diveintopython3.org/generators.html#a-list-of-patterns
Here is part of the code:
import re
def