> You could write a class with a custom __setattr__() method that checks
for valid attribute names for that class (a list of strings given to
it's __init__() method). That way you could form several restricted
"namespaces" for variables simply as different instances of that class.


This can be easier accomplished using __slots__, e.g.:

>>> class X(object):
...     __slots__ = ['a']

But in my opinion, it isn't worth it. You still don't get compile time
errors, which is probably the main reason to use strict mode.

I agree.

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

Reply via email to