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

Raymond Hettinger, one of the main Python devs, advises that the "else" in this situation should mentally be thought of as "notfound".



I think "else" should be pronounced "then" for the for and while loops. And the meaning is "then and only then."


Glad you posted this. I came to the comments to post the same thing[1] because thinking of it as "notfound" makes remembering (and comprehending it) easier. :)

[1] https://www.youtube.com/watch?v=OSGv2VnC0go#t=17m12s


Ah, I misremembered, "nobreak", not "notfound".




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

Search: