Hacker Newsnew | past | comments | ask | show | jobs | submitlogin

> it’s not super obvious what to do when the keys are equal

    d1 | d2 | d3 | ...
is equivalent to:

    {**d1, **d2, **d3, ...}


Now read the above but instead of “it’s not super obvious what

  d1 | d2
should be because losing information/desirable properties/weird errors”, read “it’s not super obvious what

  {**d1, **d2}
should be because losing information/desirable properties/weird errors”.

Except I guess one could throw in something about TOOWTDI too.


I actually think it is obvious what a dictionary merge should do (overwrite keys on the left with keys on the right), but this is besides the point because it's already been determined for

    {**d1, **d2}
In other words, there are no new semantics to discuss here. I'm just saying the two syntaxes should be equivalent.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: