On Sat, Jun 27, 2020 at 2:29 PM Steven D'Aprano <st...@pearwood.info> 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.

ChrisA
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/LT74WCVQSXAYZEDOEIVHL73QZ4YJHLI3/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to