+ 4
Why not use __slots__ in python class?
Python defaultly uses a dict to store the class instance values. Here we can change this by using the special variable __slots__. It increases the time efficiency of the class by 40-50%. So is there any reason not to use it, as I can see very rare usage of it in the classes? Especially the built-in ones.
1 Antwort