Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-07 Thread Ka-Ping Yee
On Wed, Mar 6, 2019 at 4:01 PM Chris Angelico wrote: > On Thu, Mar 7, 2019 at 10:52 AM Josh Rosenberg > wrote: > > > > Allowing dicts to get involved in + means: > > Lots of words that basically say: Stuff wouldn't be perfectly pure. > > But adding dictionaries is fundamentally *useful*. It is

Re: [Python-ideas] PEP: Dict addition and subtraction

2019-03-06 Thread Ka-Ping Yee
len(dict1 + dict2) does not equal len(dict1) + len(dict2), so using the + operator is nonsense. len(dict1 + dict2) cannot even be computed by any expression involving +. Using len() to test the semantics of the operation is not arbitrary; the fact that the sizes do not add is a defining quality