Multi Heritage with slots

Alexandre Badez alexandre.badez at gmail.com
Wed Sep 5 09:34:42 EDT 2007


On Sep 5, 2:56 pm, Michele Simionato <michele.simion... at gmail.com>
wrote:
> On Sep 5, 2:52 pm, "Simon Brunning" <si... at brunningonline.net> wrote:
>
> > On 9/5/07, Alexandre Badez <alexandre.ba... at gmail.com> 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.
>
> Right, and this the way to do what the original poster wants:
>
> http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158
>
>                   Michele Simionato

Thanks every body for your remarks.
I still have a lot to learn in python...




More information about the Python-list mailing list