can't add variables to instances of built-in classes

Peter Otten __peter__ at web.de
Mon Jul 18 03:38:33 EDT 2016


Lawrence D’Oliveiro wrote:

> On Monday, July 18, 2016 at 3:04:13 AM UTC+12, Steven D'Aprano wrote:
> 
>> __slots__ is not obsolete, but 99% of the time you shouldn't bother with
>> it.
> 
> I find __slots__ very useful. I have them right through my Qahirah classes
> <https://github.com/ldo/qahirah>, for example.

When you remove them, does your library stop working? Is there a significant 
increase of memory consumption? Or is there something I didn't think of that 
makes them useful for you?




More information about the Python-list mailing list