i'm a -0 on the PEP.

that being said, I am sure i will probably use the hell out of it. it is
very convenient syntax for mashing together several mappings:

# yuck
for d in dict_seq:
    my_dict.update(d)

# not much better
{**d1, **d2, **d3}

but i'm -0 because i am very concerned it will not be obvious to new
learners, without constantly looking it up, whether adding two mappings
together would either:

   1. create a new mapping of the type `type(mapping1)` with the
   conflicting values from dict1 having precedence
   2. create a new mapping of the type `type(mapping1)` with the
   conflicting values from dict2 having precedence
   3. create a new `dict` with the values from dict1 having precedence
   4. create a new `dict` with the values from dict2 having precedence

similarly, it is not obvious what += does:

   1. add the contents of mapping2 to mapping1, but with existing values
   from mapping1 taking precedence
   2. update mapping1 with the contents of mapping2, including updating of
   values from mapping2

there is no question this will be very challenging for many new coders.
NONE of the above choices are intuitive, even after it is explained to you.
and if you haven't done it in a while, you will have to go and look it up.
it will be a real head scratcher for a LOT of people, and a big source of
bugs.

on the contrary: it becomes very intuitive to a new user why + for mappings
does NOT exist once it is pointed out that there is the issue of
reconciling key-value-pairs conflicts to consider. this produces an "ah ha"
moment, leading to a deeper understanding of how mappings are so different
from lists/tuples.

list, tuple, and string addition, on the other hand, are inherently
intuitive. once you learn these, you pretty much never look up what they
mean again (except when you try to add a list to a tuple and get an error,
or try += with a tuple or string).

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

Reply via email to