The Industry choice

Kent Johnson kent3737 at
Tue Jan 4 13:48:17 CET 2005

Alex Martelli wrote:
> Roy Smith <roy at> wrote:
>>Stefan Axelsson <crap1234 at> wrote:
>>>Yes, ignoring most of the debate about static vs. dynamic typing, I've
>>>also longed for 'use strict'.
>>You can use __slots__ to get the effect you're after.  Well, sort of; it
>>only works for instance variables, not locals.  And the gurus will argue
>>that __slots__ wasn't intended for that, so you shouldn't do it.
> There's a simple, excellent recipe by Michele Simionato, on both the
> online and forthcoming 2nd edition printed Cookbook, showing how to do
> that the right way -- with __setattr__ -- rather than with __slots__ .

The recipe is here (it took me a few minutes to find it, I found the title misleading):


More information about the Python-list mailing list