
On 10/16/2019 10:35 PM, Brandt Bucher wrote:
At long last, Steven D'Aprano and I have pushed a second draft of PEP 584 (dictionary addition):
Please let us know what you think – we'd love to hear any *new* feedback that hasn't yet been addressed in the PEP or the related discussions it links to! We plan on updating the PEP at least once more before review.
My apologies if this feedback is not new; I did not follow the first round. Looking at the codebase I support (OpenERP 7.0), I see extensive use of the update() method. I went through and replaced a few of them with += to try and get a feel for it. + and += are a cognitive mismatch for update(). The problem is that dicts are complex objects with two pieces of information, and the results of + and += don't match what happens when two dicts are combined. For an easy demonstration of this: --> a = {'some_key': 'some value} --> a += {'some_key': 'another value'} --> a {'some_key': 'another value'} That result just doesn't match up with the '+' operator. For what it's worth, I don't think the '|' operator works any better. Reviewing my code base, I do see a benefit in replacing the updates() with an operator, but I'm not aware of any operator that captures the "update" results. -1 on the PEP. -- ~Ethan~