Swallowing exceptions, without re-throwing or logging them, is a bad practice. The stack trace, and other useful information for debugging, is lost.
1def swallow_noncompliant():
2 for i in range(10):
3 try:
4 raise ValueError()
5 finally:
6 # Noncompliant: uses continue or break or return statements
7 # in finally block.
8 continue
1def swallow_compliant():
2 for i in range(10):
3 try:
4 raise ValueError()
5 finally:
6 # Compliant: avoids using continue or break or return statements
7 # in finally block.
8 print("Done with iterations")