CosminO
CosminO

Reputation: 5226

Possible motif behind using pass after raise in Python exception handling

try:
  [code]
except Exception:
  [something]
  raise
  pass

Above code snippet looks a bit weird, doesn't it? Am I missing something? Why is there a raise and a pass following it?

Upvotes: 0

Views: 73

Answers (2)

Andriy Tylychko
Andriy Tylychko

Reputation: 16266

seems like initially it was just

except Exception:
    pass

somebody just forgot to remove it after adding exception handling

Upvotes: 1

Jakob Bowyer
Jakob Bowyer

Reputation: 34698

Its a NOP. It does nothing. Nothing at all. No clue why they left it there, because it does nothing.

Upvotes: 2

Related Questions