On Wed, Oct 23, 2019 at 11:47 PM Inada Naoki <songofacandy@gmail.com> wrote:
So reusing | to set union is very natural to me.

I understand that, and agree -- it made sense to me when set() was introduced.

But that wasn't my point -- we are not deciding now what operator to use for set union, we are deciding what operator to use for dict merging.

And I don't think that (most) people will naturally think about set union when they want to put two dicts together.

logic theory aside, most people both learn dicts first, and use them a lot more than sets.

And I don't think it's about uptake either -- I think it will be a long-standing difference. That being said, this is just a new way to spell what can already be done, so not a big deal either way.
But if we use + for dict merging, I think we should add + to set too.
Then the set has `.union()`, `|` and `+` for the same behavior.

I'd be fine with that :-) -- I suspect that if operators on dicts and sets were considered at the same time, + may well have been chosen. And if dicts supported + when sets were introduced, it probably would have been used there.

I'm going to try to avoid any more comments on this -- it's all been said, many, many times -- I think it's time for a decision, and we can all go bike-shed other things :-)


Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython