On Mon, Feb 22, 2021 at 10:27:55AM +0300, Paul Sokolovsky wrote:

> Such short generic names shouldn't be used for types added so late in
> the language evolution. Those are names for variables. (And lowercase in
> general, with the exception of handful(!) core types).

A handful you say.

int, float, str, list, tuple, dict, bytes, bytearray, set, frozenset, 
bool, memoryview, object, complex; plus some more in the stdlib such as 
deque,; plus some which are technically types but are usually used as if 
they were functions, such as slice, range, map, filter, zip, etc. So by 
my count that makes at least 15, or 20 if you include the function-like 
types.

You must have big hands.

If this bunch-of-attributes object was to move into the std lib, it 
would likely become a "core type" and we'd want it to have a short, 
simple, all-lowercase name, like the other core types.


> A typical use is:
> 
> ns = SimpleNamespace()
> 
> Anyone who doesn't agree always has "import as" in their disposal (as a
> more structured form of "whatever_i_want = official_descriptive_name").

The type is not going to be called "ns", that's too cryptic for a core 
type. We have "dict", not "dt", "int", not "it", "complex, not "cx". So 
you will still be able to say:

    ns = obj = o = bunch()

for example.

You always have `from builtins import bunch as MyLongDescriptiveName` if 
you disagree.


[...]
> So, hopefully window for the lower-case types is as closed as anytime
> (last case was indeed adding "odict" as a builtin alias for
> collection.OrderedDict instead of falling for 3.6 mapping algorithmic
> fiasco),

"Fiasco"?


> and all newly added types will follow the established
> naming conventions.

The established naming conversion for built-in standard types other than 
exceptions is all lowercase.


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

Reply via email to