On Mon, Mar 4, 2019 at 3:58 PM Christopher Barker firstname.lastname@example.org wrote:
On Mon, Mar 4, 2019 at 12:41 PM Guido van Rossum email@example.com wrote:
Honestly I would rather withdraw the subtraction operators than reopen the discussion about making dict more like set.
I think that's unfortunate.
I think the "dicts are like more-featured" sets is a math-geek perspective, and unlikely to make things more clear for the bulk of users. And may make it less clear.
I'd say reddit has some pretty "common users", and they're having a discussion of this right now (https://www.reddit.com/r/Python/comments/ax4zzb/pep_584_add_and_operators_to...). The most popular comment is how it should be |.
Anyway, I think that following the mathematical metaphors tends to make things more intuitive in the long run. Python is an adventure. You learn it for years and then it all makes sense. If dict uses +, yes, new users might find that sooner than |. However, when they learn set union, I think they will wonder why it's not consistent with dict union.
The PEP's main justification for + is that it matches Counter, but counter is adding the values whereas | doesn't touch the values. I think it would be good to at least make a list of pros and cons of each proposed syntax.
We need to be careful -- there are a lot more math geeks on this list than in the general Python coding population.
Simply adding "+" is a non-critical nice to have, but it seems unlikely to really confuse anyone.
-- Christopher Barker, PhD
Python Language Consulting
- Scientific Software Development
- Desktop GUI and Web Development
- wxPython, numpy, scipy, Cython