Browse Source

Enum

pull/10/head
Jure Šorn 5 years ago
parent
commit
25ed221c74
1 changed files with 1 additions and 1 deletions
  1. 2
      README.md

2
README.md

@ -805,13 +805,13 @@ Cutlery = Enum('Cutlery', 'knife fork spoon')
Cutlery = Enum('Cutlery', {'knife': 1, 'fork': 2, 'spoon': 3}) Cutlery = Enum('Cutlery', {'knife': 1, 'fork': 2, 'spoon': 3})
``` ```
#### Functions can not be values, so they must be wrapped:
```python ```python
from functools import partial from functools import partial
LogicOp = Enum('LogicOp', {'AND': partial(lambda l, r: l and r), LogicOp = Enum('LogicOp', {'AND': partial(lambda l, r: l and r),
'OR' : partial(lambda l, r: l or r)}) 'OR' : partial(lambda l, r: l or r)})
``` ```
* **Functions can not be values, so they must be wrapped.**
System System
------ ------

Loading…
Cancel
Save