(Feb-19-2018, 09:32 PM)Gribouillis Wrote: What's wrong with using continue in the try...except statement? I'm doing this all the timeNothing wrong just that
pass
is much more common in try...except
.There is a little difference:
continue
will jump back to the top of the loop.pass
will continue processing.So if look in Doc they always use
pass
when describing suppresses any of the specified exceptions.So if using code example over.
from contextlib import suppress import os with suppress(OSError): info = os.lstat(file) print(info)Writing the same as over with
try...except
then is pass
as in Doc.import os try: info = os.lstat(file) print(info) except OSError: pass