On Sun, Oct 20, 2019 at 6:38 PM Steven D'Aprano <st...@pearwood.info> wrote:

> 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.
>

It would be like the Judgment of Solomon though. A method is not enough to
change the dict API -- I'd rank it below "do nothing".


> 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 :-)
>

You're welcome.

-- 
--Guido van Rossum (python.org/~guido)
*Pronouns: he/him **(why is my pronoun here?)*
<http://feministing.com/2015/02/03/how-using-they-as-a-singular-pronoun-can-change-the-world/>
_______________________________________________
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/KM2HC66NLX3Y6RQWTTDRO273BYGFIGO3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to