In OCaml or similar language I would do something like this:
let hello a b c =
match (a, b, c) with
| (1, 1, 1) -> 1
| (2, 2, 2) -> 2
| (_, _, 3) -> 3
| (_, _, _) -> 4
Is there a way in Python to have this? Right now I am using
if a==1 and b==1 and c==1:
return 1
elif a==2 and b==2 and c==2:
return 2
elif c==3:
return 3
else:
return 4
Is this the most idiomatic Python to achieve that?
if a == 1 and b == 1 and c == 1becomesif (a, b, c) == (1, 1, 1)for example.