Roy Smith <[EMAIL PROTECTED]> wrote:

> Stefan Axelsson <[EMAIL PROTECTED]> 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__ .


Alex
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to