Catching errors in attribute names at assigment

Kamilche klachemin at
Thu Jun 24 16:42:02 CEST 2004

"Delaney, Timothy C (Timothy)" <tdelaney at> wrote in message news:<mailman.72.1088063043.27577.python-list at>...

> 2. This is not the purpose of   slots   - it's a side effect that some
> people abuse. The purpose of   slots   is to reduce the memory footprint
> of instances of the class.

I don't see how it's an abuse. I think it's a valid use of __slots__,
myself. The solutions people say we SHOULD be using, subclassing from
a 'frozen' class that uses __getattr__ and __setattr__, result in code
that runs 14x slower... whereas using __slots__ runs at slightly
FASTER speeds!

Maybe you can explain why using __slots__ for this is an abuse.


More information about the Python-list mailing list