goodwolf <[EMAIL PROTECTED]> wrote:
   ...
> Then you will prefer something like this:
> 
> class Namespace(object):
>     def __init__(self, __ns={}, **kwargs):
>         if kwargs: __ns.update(kwargs)
>         self.__dict__ = __ns

I might, if it weren't for the redundant "if" and the horribly buggy
interference between separate instances -- which is why I wrote it,
almost six years ago and without the bugs, as
<http://aspn.activestate.com/ASPN/Python/Cookbook/Recipe/52308> .

Not much later, in the printed Cookbook, I also gave some other good
ways and explained (as I did in the current thread) why confusing
attributes and items, as proposed in most of this thread, is really a
bad idea.


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

Reply via email to