On Sat, Jun 27, 2020 at 2:29 PM Steven D'Aprano firstname.lastname@example.org wrote:
Seriously, I genuinely thought that the existing behaviour was the opposite and that `add` unconditionally added the element. "Last seen wins". If I was designing sets, that's probably how I would design it. After all, it's called *add*, not *add if not already there*. I was so sure that this was the current behaviour that I didn't bother to check it before posting, which is rare for me.
So I think this counts as the principle of maximal surprise :-)
Well, that's not how Python's dicts OR sets work, so that would be inconsistent. But feel free to do it your own way in your own language.