Alex Martelli wrote:
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__ .

The recipe is here (it took me a few minutes to find it, I found the title misleading): http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/252158

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

Reply via email to