Yeah, the biggest risk with for-else is that some inexperienced dev comes along and misreads the else as belonging to an if statement inside the for (or, worse, attempting to “fix” it). I’ve seen this happen more than once…
Yes I always comment on it for this reason, sometimes (if I know the code will be maintained by someone with less python experience) with a link to the standard doc.
It's actually a super useful pattern for any kind of search iteration. I've used it many times.
It's actually a super useful pattern for any kind of search iteration. I've used it many times.