I would like to get the first item from a list matching a condition. It\'s important that the resulting method not process the entire list, which could be quite large. For e
This question already has great answers. I'm only adding my two cents because I landed here trying to find a solution to my own problem, which is very similar to the OP.
If you want to find the INDEX of the first item matching a criteria using generators, you can simply do:
next(index for index, value in enumerate(iterable) if condition)