Timeline for Get the first item from an iterable that matches a condition
Current License: CC BY-SA 2.5
6 events
when toggle format | what | by | license | comment | |
---|---|---|---|---|---|
Feb 28, 2017 at 23:04 | review | Suggested edits | |||
Mar 1, 2017 at 0:09 | |||||
Mar 3, 2010 at 17:23 | vote | accept | Chris Phillips | ||
Mar 3, 2010 at 17:23 | |||||
Mar 2, 2010 at 16:49 | comment | added | Mike Graham |
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.
|
|
Mar 2, 2010 at 10:56 | comment | added | S.Lott | +1: Not obscure, nor abusive. All things considered, the last one seems pretty clean. | |
Mar 2, 2010 at 7:37 | history | edited | Matt Anderson | CC BY-SA 2.5 |
added 298 characters in body
|
Mar 2, 2010 at 7:27 | history | answered | Matt Anderson | CC BY-SA 2.5 |