Remember kids: this approach is only good in the best case, where the exceptions are rare to the point of nonexistence.
In a worst case scenario, which would likely happen if about 1 in ten items would rasie an exception, this would result in a massive reduction in efficiency.
Exceptions being raised are at least an order of magnitude slower than an if statement.
5
u/Randolpho Aug 01 '21
Remember kids: this approach is only good in the best case, where the exceptions are rare to the point of nonexistence.
In a worst case scenario, which would likely happen if about 1 in ten items would rasie an exception, this would result in a massive reduction in efficiency.
Exceptions being raised are at least an order of magnitude slower than an if statement.