From 8784ad494e066c36422ac23bc4d94ed90d54ee3a Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Jure=20=C5=A0orn?= Date: Sun, 16 Dec 2018 11:08:12 +0100 Subject: [PATCH] Updates --- README.md | 15 +++++++++++++++ 1 file changed, 15 insertions(+) diff --git a/README.md b/README.md index f3e6626..6071de2 100644 --- a/README.md +++ b/README.md @@ -78,9 +78,14 @@ Set = set() .add() .update() +.clear() +``` + +```python = .union() = .intersection() = .difference() + = .symmetric_difference() = .issubset() = .issuperset() ``` @@ -499,6 +504,13 @@ class : return cls.__name__ ``` +#### Constructor overloading: +```python +class C: + def __init__(self, a=None): + self.a = a +``` + ### Enum ```python from enum import Enum, auto @@ -540,6 +552,9 @@ Cutlery = Enum('Cutlery', {'knife': 1, 'fork': 2, 'spoon': 3}) # Functions can not be values, so they must be enclosed in tuple: LogicOp = Enum('LogicOp', {'AND': (lambda l, r: l and r, ), 'OR' : (lambda l, r: l or r, )} +# But 'list()' will only work if there is another value in tuple: +LogicOp = Enum('LogicOp', {'AND': (auto(), lambda l, r: l and r), + 'OR' : (auto(), lambda l, r: l or r)} ``` ### Copy