Skip to content

Instantly share code, notes, and snippets.

@FerdinaKusumah
Created July 28, 2020 13:23
Show Gist options
  • Save FerdinaKusumah/3d59fb5dcf186d3fab9c27f4111502c8 to your computer and use it in GitHub Desktop.
Save FerdinaKusumah/3d59fb5dcf186d3fab9c27f4111502c8 to your computer and use it in GitHub Desktop.
[Python] Chain function Call
"""Chain function call"""
def sum_number(x: int, y: int) -> int:
return x + y
def sub_number(x: int, y: int) -> int:
return x - y
need_to_sum = True
a = 10
b = 4
c = (sum_number if need_to_sum is True else sub_number)(a, b)
# 14
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment