use lists instead of tuples in generator chapter too [thanks A.H.]

This commit is contained in:
Mark Pilgrim
2009-05-16 01:38:26 -04:00
parent 0a884ee32b
commit 9f96f01e07
6 changed files with 21 additions and 21 deletions
+3 -3
View File
@@ -12,13 +12,13 @@ def build_match_and_apply_functions(pattern, search, replace):
return re.search(pattern, word)
def apply_rule(word):
return re.sub(search, replace, word)
return (matches_rule, apply_rule)
return [matches_rule, apply_rule]
class LazyRules:
rules_f = 'plural6-rules.txt'
rules_filename = 'plural6-rules.txt'
def __init__(self):
self.pattern_file = open(self.rules_f)
self.pattern_file = open(self.rules_filename)
self.cache = []
def __iter__(self):