mirror of
https://github.com/kennethreitz/dive-into-python3.git
synced 2026-06-05 23:10:17 +00:00
use lists instead of tuples in generator chapter too [thanks A.H.]
This commit is contained in:
+5
-5
@@ -31,11 +31,11 @@ def match_default(noun):
|
||||
def apply_default(noun):
|
||||
return noun + 's'
|
||||
|
||||
rules = ((match_sxz, apply_sxz),
|
||||
(match_h, apply_h),
|
||||
(match_y, apply_y),
|
||||
(match_default, apply_default)
|
||||
)
|
||||
rules = [[match_sxz, apply_sxz],
|
||||
[match_h, apply_h],
|
||||
[match_y, apply_y],
|
||||
[match_default, apply_default]
|
||||
]
|
||||
|
||||
def plural(noun):
|
||||
for matches_rule, apply_rule in rules:
|
||||
|
||||
Reference in New Issue
Block a user