diff --git a/examples/plural5.py b/examples/plural5.py index 14845c7..31e192a 100644 --- a/examples/plural5.py +++ b/examples/plural5.py @@ -24,6 +24,7 @@ def plural(noun): for matches_rule, apply_rule in rules(): if matches_rule(noun): return apply_rule(noun) + raise ValueError('no matching rule for {0}'.format(noun)) if __name__ == '__main__': import sys diff --git a/generators.html b/generators.html index 245163b..c9008e4 100644 --- a/generators.html +++ b/generators.html @@ -304,7 +304,8 @@ rules = [] def plural(noun): for matches_rule, apply_rule in rules(): if matches_rule(noun): - return apply_rule(noun) + return apply_rule(noun) + raise ValueError('no matching rule for {0}'.format(noun))
How the heck does that work? Let’s look at an interactive example first.