Currently I'm doing this:
try:
something = next(iterator)
# ...
except StopIteration:
# ...
But I would like an expression that I can place inside a simple if
statement. Is there anything built-in which would make this code look less clumsy? I only need to check for the first item.