def throws(f, *a, **k):
    "Return True if f(*a,**k) raises an exception."
    try:
        f(*a,**k)
    except:
        return True
    else:
        return False
Return True if f(*a,**k) raises an exception.
recipes/Python/252530_ExceptiHandling/recipe-252530.py