On Wed, Oct 23, 2019 at 1:19 PM Christopher Barker <pythonchb@gmail.com> wrote:
On Wed, Oct 23, 2019 at 5:42 AM Rhodri James <rhodri@kynesim.co.uk> wrote:
> I'm surprised by that description. I don't think it is just newcomers
> who either suggest or prefer plus over pipe, and I don't think that pipe
> is "more accurate".

+1 (as one of the non-newcomers who prefers plus)

me too.

frankly, the | is obscure to most of us. And it started as "bitwise or", and evokes the __or__ magic method -- so why are we all convinced that somehow it's inextricably linked to "set union"? And set union is a bit obscure as well -- I don't think that many people (newbies or not) would jump right to this logic:
In my particular case I do know what `|` means in a set context. However, when I see code using it, it takes me a while to understand what it means and I tend to replace the operator with an explicit call to the union method.

The only problem with that is when `dict_keys` are in use, as they do implement the `|` operator, but not the `union` method. They only have  `isdisjoint`.
 

I need to put two dicts together
That's kind of like a set union operation
The set object uses | for union
That's probably what dict uses -- I'll give that t try.

Rather than:

I need to put two dicts together
I wonder if dicts support addition?
I'll give that a try.

so, I'm

+1 on +
+0 on |

if | is implemented, I'll bet you dollars to donuts that it will get used far less than if + were used.

(though some on this thread would think that's a good thing :-) )

-CHB


--
Christopher Barker, PhD

Python Language Consulting
  - Teaching
  - Scientific Software Development
  - Desktop GUI and Web Development
  - wxPython, numpy, scipy, Cython
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-leave@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/TE2IFV2PIUADS35TD6BHPEO5KG6DDTNT/
Code of Conduct: http://python.org/psf/codeofconduct/


--
Sebastian Kreft