From 33450d983526419a68ceb005f081bda1a454b8b2 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 27 Jan 2019 10:20:47 +0100 Subject: [PATCH] Inline --- README.md | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/README.md b/README.md index 0298b5a..8507bef 100644 --- a/README.md +++ b/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()