Arnaud Delobelle wrote:

I missed the start of this discussion but there are two simpler ways:

def func(iterable):
    for x in iterable:
        print(x)
        return
    raise ValueError("... empty iterable")


For the immediate case this is a cool solution.

Unfortunately, it doesn't fix the unwanted nesting of exceptions problem.

~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list

Reply via email to