Browse Source

Inline

pull/10/head
Jure Šorn 6 years ago
parent
commit
33450d9835
1 changed files with 4 additions and 0 deletions
  1. 4
      README.md

4
README.md

@ -530,11 +530,15 @@ from functools import reduce
from collections import namedtuple
Point = namedtuple('Point', 'x y')
point = Point(0, 0)
```
```python
from enum import Enum
Direction = Enum('Direction', 'n e s w')
Cutlery = Enum('Cutlery', {'knife': 1, 'fork': 2, 'spoon': 3})
```
```python
# Warning: Objects will share the objects that are initialized in the dictionary!
Creature = type('Creature', (), {'p': Point(0, 0), 'd': Direction.n})
creature = Creature()

Loading…
Cancel
Save