Enable Javascript in your browser and then refresh this page, for a much enhanced experience.
First solution in Creative category for Min and Max by light2happy.718
def wrapper(cmp_func):
def inner(*args, **kwargs):
key = kwargs.get("key", lambda x: x)
it = iter(args[0] if len(args) == 1 else args)
result = next(it)
for v in it:
if cmp_func(key(v), key(result)):
result = v
return result
return inner
@wrapper
def min(a, b):
return a < b
@wrapper
def max(a, b):
return a > b
May 24, 2015
Comments: