|
|
|
|
|
by random_throw
2948 days ago
|
|
This is discussed as item 12 in Effective Python. The author argues that you should avoid "else" blocks after "for" and "while" loops. The main argument is that the behavior is not intuitive and could be confusing upon reading given its somewhat obscure usage. He suggests using a helper function with an early exit or setting a result variable and using a break in your loop instead. |
|