2 ms·
How is that ultimately different from handling the exception under `except`?
by mfgs 5y ago
How is that ultimately different from handling the exception under `except`?
- coldtea 5y ago"in the usual Python vein of introducing an abstraction to save 2-3 lines"
- ledauphin 5y agothis is what abstractions are for. they can be done poorly or well, but there's a reason iterators are favored in most use cases over for (i = 0, i < n; i++) { a[i] } - they're simpler to reason about because they restrict the conceptual operational space.
- formerly_proven 5y agoThe "delegate" statement encapsulates which exceptions are handled and how in the supplied callable expression. This is functionally different from repeating "except (FooExc, BarExc, BazExc) as exc: handle(exc)". It would also save two to three lines on average.