def log_params(func):
def wrapper(*args, **kwargs):
return_value = func(*args, **kwargs)
print(f"{args} -> {return_value}")
return wrapper
@log_params
def summation(a: int, b: int) -> int:
return a + b
summation(10, 20)
Preview:
downloadDownload PNG
downloadDownload JPEG
downloadDownload SVG
Tip: You can change the style, width & colours of the snippet with the inspect tool before clicking Download!
Click to optimize width for Twitter