Multi Heritage with slots

Simon Brunning simon at
Wed Sep 5 14:52:00 CEST 2007

On 9/5/07, Alexandre Badez <alexandre.badez at> wrote:
> I use __slots__ not for memory optimization nor doing java.
> I use __slots__ because my class are used by other lib, and in the
> past, some of them misspell some attributes and involved a very
> annoying comportment of the global application.
> So the objective is only to prevent unwanted dynamism (but not in all
> the application, just some class).

Using slots to prevent the creation of new properties is what Eric
*means* by "doing java". You're trying to write Java style code in
Python, and it's not going to be pretty. Slots are not intended for
this purpose, and they aren't very good for it.

Simon B.
simon at
GTalk: simon.brunning | MSN: small_values | Yahoo: smallvalues

More information about the Python-list mailing list