.discard(x)
: This operation removes element from the set.
If element does not exist, it does not raise a KeyError.
.remove(x)
: This operation removes element from the set.
If element does not exist, it raises a KeyError.
So my question is, where is the reason to use remove(x)
function since it can cause problem to our program by erasing an error. I feel like it is useless function since discard(x)
does the exact same thing without causing any unpredictable behavior to our program.