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

In my teaching of python to newcomers (mostly coming from matlab/R or no programming background) they often try to do dict_a + dict_b, and are confused as to why that doesn’t work when list_a + list_b works fine.

It think it’s an extreme stretch to claim it’s non-intuitive.



If dict addition was purely insertion, I would agree with you, but there is no way the following is intuitive:

  {1 : 1} + {1 : 2} ==> {1 : 2}




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

Search: