Re: [Tutor] Not understanding this code example. Help, please.

2010-02-13 Thread Alan Gauld
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 =

Re: [Tutor] Not understanding this code example. Help, please.

2010-02-13 Thread Kent Johnson
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

[Tutor] Not understanding this code example. Help, please.

2010-02-12 Thread Eduardo Vieira
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