On 27/06/20 4:25 pm, Steven D'Aprano wrote:
Seriously, I genuinely thought that the existing behaviour was the
opposite and that `add` unconditionally added the element. "Last seen
wins".

The fact that you haven't noticed until now suggests that
you've never written any code that depends on the difference.

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*.

But equally, if it's already there, there's no need to do
anything, right?

I don't think it's possible to intuit the behaviour from
the name "add".

I also think that it doesn't matter, and if it does, then
a set probably isn't the right data structure for your
application.

--
Greg
_______________________________________________
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/WDNSZDNHGYBXFEIFXY3XYHW6CZGPIN2E/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to