Python __slots__

python __slots__

__slots__. By default, instances of both old and new-style classes have a dictionary for attribute storage. This wastes space for objects. A slot is nothing more than a memory management nicety: when you define __ slots__ on a class, you're telling the Python interpreter that the. By default Python uses a dict to store an object's instance attributes. It involves the usage of __slots__ to tell Python not to use a dict, and only allocate space. python __slots__

Video

Aaron Hall Slot or not higher performance custom objects in pure Python PyCon 2017

0 Comments

Hinterlasse eine Antwort

Deine E-Mail-Adresse wird nicht veröffentlicht. Erforderliche Felder sind markiert *