Skip to content

Commit 778e408

Browse files
committed
Enum
1 parent a524c02 commit 778e408

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

README.md

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -679,11 +679,11 @@ Cutlery = Enum('Cutlery', 'knife fork spoon')
679679
Cutlery = Enum('Cutlery', {'knife': 1, 'fork': 2, 'spoon': 3})
680680
```
681681

682+
**Functions can not be values, unless they are wrapped.**
682683
```python
683-
# Functions can not be values, unless they are wrapped:
684684
from functools import partial
685-
LogicOp = Enum('LogicOp', {'AND': partial(lambda l, r: l and r),
686-
'OR' : partial(lambda l, r: l or r)})
685+
LogicOp = Enum('LogicOp', {'and': partial(lambda l, r: l and r),
686+
'or' : partial(lambda l, r: l or r)})
687687
```
688688

689689

@@ -1137,8 +1137,7 @@ import operator as op
11371137
product_of_elems = functools.reduce(op.mul, <list>)
11381138
sorted_by_second = sorted(<list>, key=op.itemgetter(1))
11391139
sorted_by_both = sorted(<list>, key=op.itemgetter(1, 0))
1140-
LogicOp = enum.Enum('LogicOp', {'AND': op.and_,
1141-
'OR' : op.or_})
1140+
LogicOp = enum.Enum('LogicOp', {'and': op.and_, 'or' : op.or_})
11421141
```
11431142

11441143

0 commit comments

Comments
 (0)