Message314503
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 |
|
| Date |
User |
Action |
Args |
| 2018-03-27 07:18:01 | serhiy.storchaka | set | recipients:
+ serhiy.storchaka, rhettinger, jaraco, ncoghlan |
| 2018-03-27 07:18:01 | serhiy.storchaka | set | messageid: <1522135081.12.0.467229070634.issue33146@psf.upfronthosting.co.za> |
| 2018-03-27 07:18:01 | serhiy.storchaka | link | issue33146 messages |
| 2018-03-27 07:18:01 | serhiy.storchaka | create | |
|