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

I'm not suggesting anything about subtraction on sets. I'm suggesting that + is not appropriate for dictionary merge because it doesn't behave like + on other Python containers.

The context is Python, not other languages. In a language that used + for set union, + would also be fine for dictionary merge.

But Python isn't like that. Strings, tuples, and lists have + and do not have -, and for all of them the + operator does add lengths. Sets have | and -, and those operators do not add or subtract lengths.



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

Search: