Why is this a discussion?!
Just start your program with:
from types import SimpleNamespace as myfavname
On Wed, Feb 17, 2021 at 11:22 PM Daniel Moisset
If we're bike shedding, I'd go for "mutableobject". It's not terribly short, but it is built on familiar python terminology and does exactly what it says in the box: like object() but mutable
On Wed, 17 Feb 2021, 23:01 Chris Angelico,
wrote: On Thu, Feb 18, 2021 at 8:53 AM Brendan Barnwell
wrote: On 2021-02-17 11:21, Chris Angelico wrote:
Okay. Let's start bikeshedding. If SimpleNamespace were to become a builtin, what should its name be? It needs to be short (obviously), but not TOO short, and it needs to be at least somewhat descriptive, and it needs to not cause confusion with "object". Ideally, it should get a name that's unlikely to conflict with names already in frequent use.
* namespace * ns * Thing * dump * plunkit
Does using SimpleNamespace have any other meaningful
ramifications
besides being able to add attributes? 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. Given that, I think a name like `attrdict` would be appropriate. (There is already a PyPI package called attrdict that uses this name for this purpose: https://pypi.org/project/attrdict/ , And I feel like I've seen other examples of similar names where someone wrote their own mini-implementation of such a thing.)
The main thing it has is a very useful repr, but that doesn't conflict with the name attrdict.
ChrisA _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/BNXRZJ... Code of Conduct: http://python.org/psf/codeofconduct/
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/VZ7ZAX... Code of Conduct: http://python.org/psf/codeofconduct/
-- The dead increasingly dominate and strangle both the living and the not-yet born. Vampiric capital and undead corporate persons abuse the lives and control the thoughts of homo faber. Ideas, once born, become abortifacients against new conceptions.