set.add() doesn't replace equal element

Ian Pilcher arequipeno at gmail.com
Fri Dec 30 16:41:19 EST 2022


I just discovered this behavior, which is problematic for my particular
use.  Is there a different set API (or operator) that can be used to
add an element to a set, and replace any equal element?

If not, am I correct that I should call set.discard() before calling
set.add() to achieve the behavior that I want?

-- 
========================================================================
Google                                      Where SkyNet meets Idiocracy
========================================================================


More information about the Python-list mailing list