On Wed, Feb 17, 2021 at 11:28:05AM -0800, Brendan Barnwell wrote:

> When I see people suggest 
> SimpleNamespace, it's usually just to use it as a dict which is accessed 
> with attribute syntax instead of item syntax.

If its a dict, it must have dict methods. That leads to conflict: data 
fields and methods collide.

A Bunch (see my previous post) or SimpleNamespace doesn't have that 
problem. A Bunch has no methods (apart from dunders) and so there is no 
way for them to collide with field names.

Things like attrdict, and the Javascript "convenience" short-cut that 
allows dict key:item pairs to be accessed through attribute syntax, are 
an attractive nuisance because of that collision problem.


-- 
Steve
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/5SGLEXYT37JWIB4N4LQGEUVZUQ7JOSPX/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to