mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
return tuple of functions, not a list, in plural4
This commit is contained in:
+1
-1
@@ -12,7 +12,7 @@ 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)
|
||||
|
||||
rules = []
|
||||
with open('plural4-rules.txt', encoding='utf-8') as pattern_file:
|
||||
|
||||
+1
-1
@@ -271,7 +271,7 @@ $ $ s</code></pre>
|
||||
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)
|
||||
|
||||
rules = []
|
||||
<a>with open('plural4-rules.txt', encoding='utf-8') as pattern_file: <span class=u>②</span></a>
|
||||
|
||||
Reference in New Issue
Block a user