Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
One honking great idea solution in Clear category for Compare Functions by veky
import contextlib
def checkio(*funcs):
def h(*a, **kw):
result = dict.fromkeys(funcs)
for f in funcs:
with contextlib.suppress(Exception): result[f] = f(*a, **kw)
f, g = result.values()
if f is g is None: return None, 'both_error'
if f is None: return g, 'f_error'
if g is None: return f, 'g_error'
return f, 'same' if f == g else 'different'
return h
Nov. 7, 2017