Skip to main content

You are not logged in. Your edit will be placed in a queue until it is peer reviewed.

We welcome edits that make the post easier to understand and more valuable for readers. Because community members review edits, please try to make the post substantially better than how you found it, for example, by fixing grammar or adding additional resources and hyperlinks.

2
  • +1: Not obscure, nor abusive. All things considered, the last one seems pretty clean.
    – S.Lott
    Commented Mar 2, 2010 at 10:56
  • 7
    The last one isn't at all clean—for foo in genex: break is just a way of doing foo = next(genex) without making the assignment clear and with the exception that would be raised if the operation doesn't make sense being squashed. Ending up with a failure code instead of catching an exception is usually a bad thing in Python. Commented Mar 2, 2010 at 16:49