2 ms·
I see __slots__ come up quite often (I think more often than it should). It's great to be aware of, but shouldn't be used unless necessary. Like any optimizat
by pfranz 9y ago
I see __slots__ come up quite often (I think more often than it should). It's great to be aware of, but shouldn't be used unless necessary. Like any optimization, it can make code maintenance more difficult. Obviously, you have to update slots if you add more attributes to the class, but you have to be aware of slots when dealing with class inheritance.