(using Python 3.1)
I know this question has been asked many times for a general testing question if the iterator is empty; obviously there is no neat solution for this (I think, for some reason, the iterator really does not know if it is empty until it asks to return its next value).
I have a specific example, however I was hoping that I could make a clean and Pythonic code out of it:
def f(lst):
flt = filter(lambda x : x is not None and x != 0, lst)
if
return None
return min(flt)
Is there a better way to do this?
EDIT: sorry for the dumb designation. A function parameter is indeed an iterable, not a list.
source
share