On Sep 5, 2:52 pm, "Simon Brunning" <[EMAIL PROTECTED]> wrote: > On 9/5/07, Alexandre Badez <[EMAIL PROTECTED]> 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 -- http://mail.python.org/mailman/listinfo/python-list