Protocols

Protocols

The terms "iterator protocol" or "descriptor protocol" are already familiar and have been used for a long time. However, now protocols can be described in …

Xor0x
1 min read
Continue Reading
Singleton design pattern

Singleton design pattern

class Singleton: instance = None def __new__(cls): if cls.instance is None: cls.instance = super().__new__(cls) return cls.instance a = Singleton() b = Singleton() print(a is b) …

Xor0x
1 min read
Continue Reading