[Python-ideas] The @update operator for dictionaries

Christopher Barker pythonchb at gmail.com
Sun Mar 10 16:18:11 EDT 2019


Are you all REALY=LU proposing more operators?

Adding @ made sense because there was an important use case for which there
was no existing operator to use.

But in this case, we have + and | available, both of which are pretty good
options.

Finally, which dicts are a very important ue ase, do we want to add an
operator just for that?

What would it mean for sets, for instance?

I have to say, the whole discussion seems to me to be a massive
bike-shedding exercise -- the original proposal was to simply define + for
dicts.

It's totally reasonable to not like that idea at all, or to propose that |
is a better option, but this has really gone off the rails!

I guess I say that because this wasn't started with a critical use-case
that really needed a solution, but rather: "the + operator isn't being used
for dicts, why not make a semi-common operation easily available"

So my opinion, which I'm re-stating:

using + to merge dicts is simple, non-disruptive, and unlikely to really
confuse anyone - so why not?

( | would be OK, too, though I think a tad less accessible to newbies)

But I don't think that having an operator to merge dicts is a critical
use-case worth of adding a new operator or new syntax to the to the
language.

-CHB


-- 
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-ideas/attachments/20190310/670bd1a6/attachment.html>


More information about the Python-ideas mailing list