Serhiy Storchaka <[email protected]> added the comment:
try:
s.remove(x)
except KeyError:
# did not exist
else:
# existed
But catching exception in Python is expensive.
----------
nosy: +rhettinger, serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue35117>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com