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

2010-02-13 Thread Eduardo Vieira
On Sat, Feb 13, 2010 at 7:59 AM, Kent Johnson wrote: > On Fri, Feb 12, 2010 at 11:49 PM, Eduardo Vieira > 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/e

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 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 > http://diveintopython3.org/generator

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

2010-02-13 Thread Alan Gauld
"Eduardo Vieira" 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 = \ ( ('[sxz]$',

[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 de