
On Feb 12, 2015, at 6:43 PM, Eric Snow <ericsnowcurrently@gmail.com> wrote:
On Thu, Feb 12, 2015 at 3:43 AM, Steven D'Aprano <steve@pearwood.info> wrote:
A very strong -1 on the proposal. We already have a perfectly good way to spell dict += , namely dict.update. As for dict + on its own, we have a way to spell that too: exactly as you write above.
From what I understand, the whole point of "d + d" (or "d | d") is as an alternative to the PEP 448 proposal of allowing multiple keyword arg unpacking clauses ("**") in function calls. So instead of "f(**a, **b)" it would be "f(**a+b)" (or "f(**a|b)"). However, the upside to the PEP 448 syntax is that merging could be done without requiring an additional intermediate dict. Personally, I'd rather have the syntax than the operator (particularly since it would apply to the dict constructor as well: "dict(**a, **b, **c)”)
That’s one potential use case but it can be used in a lot more situations than just that one. Hence why I said in that thread that being able to merge dictionaries is a much more general construct than only being able to merge dictionaries inside of a function call. --- Donald Stufft PGP: 7C6B 7C5D 5E2B 6356 A926 F04F 6E3C BCE9 3372 DCFA