Skip to content

Commit d0d7436

Browse files
committed
Documentation updated
1 parent 06f8770 commit d0d7436

File tree

1 file changed

+7
-2
lines changed

1 file changed

+7
-2
lines changed

README.md

Lines changed: 7 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,13 @@ Usage:
1414
>>> list(idioms.select(prices,constraints))
1515
['cake', 'bread']
1616

17-
# another option - use default operator module mapping
18-
# for constraints.
17+
# second option - supply your own constraing mapping to functions
18+
>>> constraints = {'cake': ('less', 60), 'bread': ('less', 30), 'pie': ('lessorequal', 80)}
19+
>>> cmap = {'less': operator.lt, 'lessorequal': operator.le}
20+
>>> list(idioms.select(prices,constraints, cmap=cmap))
21+
['cake', 'bread']
22+
23+
# best option - use default operator module mapping for comparison constraints.
1924
>>> constraints = {'cake': ('<', 60), 'bread': ('<=', 20), 'pie': ('<', 80)}
2025
>>> list(idioms.select(prices,constraints, use_operator=True))
2126
['cake', 'bread']

0 commit comments

Comments
 (0)