22 Mar
2016
22 Mar
'16
9:52 p.m.
On 22.03.2016 21:36, Vito De Tullio wrote:
Steven D'Aprano wrote:
def test(): x = sentinel = object() iterable = some_function() for x in iterable: # you know the rest onestly, I just don't like the sentinel approach... while not perfect I prefer the explicit check on the throws of the StopIteration of the next function
iterable = iter(some_function()) try: e = iter(iterable) except StopIteration: # empty else: # stuff with e for e in iterable: # stuff with e
I tend to agree. Best, Sven