[Python-ideas] Dict joining using + and +=

Rhodri James rhodri at kynesim.co.uk
Tue Mar 5 06:49:17 EST 2019

On 05/03/2019 09:42, Jimmy Girardet wrote:
> Indeed the "obscure" argument should be thrown away.
> The `|` operator in sets seems to be evident for every one on this list
> but I would be curious to know how many people first got a TypeError
> doing set1 + set2 and then found set1 | set2 in the doc.

Every.  Single.  Time.

I don't use sets a lot (purely by happenstance rather than choice), and 
every time I do I have to go and look in the documentation because I 
expect the union operator to be '+'.

> Except for math geek the `|` is always something obscure.

Two thirds of my degree is in maths, and '|' is still something I don't 
associate with sets.  It would be unreasonable to expect '∩' and '∪' as 
the operators, but reasoning from '-' for set difference I always expect 
'+' and '*' as the union and intersection operators.  Alas my hopes are 
always cruelly crushed :-)

Rhodri James *-* Kynesim Ltd

More information about the Python-ideas mailing list