Raymond Hettinger <raymond.hettin...@gmail.com> added the comment:
Only the magic methods need to be added: __getitem__, __setitem__, and __delitem__, __contains__, __len__, and __iter__. The non-dunder names risk incursion into user-space names. >>> SimpleNamespace(username1='value1', username2='value2') namespace(username1='value1', username2='value2') >>> dir(_) ['__class__', '__delattr__', '__dict__', '__dir__', '__doc__', '__eq__', '__format__', '__ge__', '__getattribute__', '__gt__', '__hash__', '__init__', '__init_subclass__', '__le__', '__lt__', '__ne__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'username1', 'username2'] ---------- _______________________________________ Python tracker <rep...@bugs.python.org> <https://bugs.python.org/issue40284> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com