On Mon, Feb 22, 2021 at 1:11 PM Brendan Barnwell <brenb...@brenbarn.net> 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.
>
>         Thinking about this more, I think the main obstacle to use of
> SimpleNamespace isn't the name, it's its the location.  No one is going
> to look in the types module for something like this.
>
>         Why not just put SimpleNamespace in the collections module?  The one 
> in
> types could be aliased to it (or vice versa if we really don't want to
> change anything).  That seems like it's a trivial change that would
> greatly increase discoverability of SimpleNamespace without adding
> complexity of any kind.

I absolutely agree, and that's going to be the cornerstone of the
proposal :) But at the same time as putting into collections, we can
also give it a much shorter name. Whatever happens, it's going to be
an exact alias for types.SimpleNamespace, which isn't going away.

In my mind, the current front-runners are:

* namespace
* ns
* thing
* mutableobject
* mobject
* attrobject
* bunch

I've written them all in lowercase, but equally viable would be to
spell it MutableObject etc. Half of the collections module is each way
at the moment.

Picture yourself in need of something like this. Would you browse the
collections module, and if so, which of these names would grab your
attention?

Counter: Picture yourself needing something unrelated, like a way to
figure out the ten most common numbers in a list. If you were to
browse the collections module looking for that, which of these names
would falsely grab your attention? Those names are too generic.

ChrisA
_______________________________________________
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/EUCLXKVTD2O6TCISXDXWC66VSB4BZEEU/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to