On Mon, Feb 22, 2021 at 11:22:09AM +0000, Rob Cliffe via Python-ideas wrote:

> What's wrong with "namespace"?  None of the other names IMO convey the 
> intended/suggested use nearly as well.

The problem with "namespace" is that the intended us is not as a 
namespace, but as a dict using `.` syntax instead of `["key"]` syntax, 
as in Javascript.

The normal use of a namespace is something that you *implicitly* lookup 
names in, e.g. locals, globals, builtins. Whereas this is more of a 
key:value store where the keys are restricted to identifiers and you use 
attribute syntax to access the values.

I know there's a lot of overlap in functionality and semantics between 
objects, namespaces and dicts, but generally speaking we don't talk 
about an int being a namespace when we look up a method:

    (47295).bit_length()

nor do we normally think of a dict as a namespace, unless it's the 
backend data store of globals etc.

So we have the funny situation that *technically* every object is a 
namespace, but the objects that we use as namespaces are usually dicts, 
and we don't use dict attributes as the namespace names/values, we use 
keys/values instead.
_______________________________________________
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/YAUXWUSOHQ5CKTZPI577HR4BWQY7FK4Q/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to