Serhiy Storchaka <[email protected]> added the comment:
I'm not sure that contextlib.suppress() should be added at first place.
try:
os.remove(somefile)
except FileNotFoundError:
pass
is a tiny bit longer, but is more explicit, doesn't depend on the other module,
works in all Python versions that have this exception, and is easily extensible.
try:
os.remove(somefile)
except FileNotFoundError as e:
# what do you want to do with e?
pass
----------
nosy: +serhiy.storchaka
_______________________________________
Python tracker <[email protected]>
<https://bugs.python.org/issue33146>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe:
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com