A good and thread-safe way to do this is to just try it and ignore the exception:
try:
a.remove(10)
except ValueError:
pass # do nothing!
A good and thread-safe way to do this is to just try it and ignore the exception:
try:
a.remove(10)
except ValueError:
pass # do nothing!