Hacker News new | past | comments | ask | show | jobs | submit login

Your second example looks fine to me.

EDIT: My best guess as to what's going on is that they want to display the for-else idiom which could be useful in other contexts (e.g. if you don't want to return anything from inside the loop and can't break out that way.) It's a kinda surprising idiom; I had forgotten you could even do that in Python and at first thought it might be a misindentation until I realized the logic would be wrong if the else paired with if.




Guidelines | FAQ | Lists | API | Security | Legal | Apply to YC | Contact

Search: