
On Sun, Oct 20, 2019 at 03:06:16PM -0700, Guido van Rossum wrote:
So the choice is really only three way.
1) Add d1 + d2 and d1 += d2 (using similarity with list + and +=) 2) Add d1 | d2 and d1 |= d2 (similar to set | and |=) 3) Do nothing
Are you saying a method is a non-starter? A method won't satisfy those who prefer an operator, but it otherwise has a number of advantages, and few (that I can see) disadvantages. I think your analysis here:
IMO the reason this is such a tough choice is that Python learners are typically introduced to list and dict early on, while sets are introduced later. [...] So if we want to cater to what most beginners will know, + and += would be the best choice. But if we want to be more future-proof and consistent, | and |= are best -- after all dicts are closer to sets (both are hash tables) than to lists. (I know you can argue that dicts are closer to lists because both support __getitem__ -- but I find that similarity shallower than the hash table nature.)
is excellent, and I think I shall steal it for the PEP :-) -- Steven