![](https://secure.gravatar.com/avatar/880ac02012dcaf99f0392f69af4f8597.jpg?s=120&d=mm&r=g)
March 2, 2022
12:50 a.m.
On 01/03/2022 22:25, Chris Angelico wrote:
class MyBreak(Exception): pass
try: do_this() if condition: raise MyBreak do_that() if condition: raise MyBreak do_next_step() if condition: raise MyBreak do_last_step() except MyBreak: pass
It doesn't feel right to me to use exceptions purely to direct control flow. YMMV. As I see it, the original meaning of an exception (in whatever language) is "something unexpected has happened" or "something has gone wrong". While it is too narrow to insist that they only be used with that meaning, this use doesn't feel like a good fit. Rob Cliffe