Java's Set.add
function will return a boolean value, which is true
if the set did not already contain the specified element.
Python's Set.add
does not have a return value.
Seems like in Python if I want to do the same thing, I have to check if it is in the set first and then add it if not.
Is there a simpler way to do that (preferably a one-liner)?
Ref:
https://docs.oracle.com/javase/7/docs/api/java/util/Set.html#add(E)
https://docs.python.org/2/library/sets.html#sets.Set