I need to make a function which accepts just an specific kind of functions how parameters, for example just binaries functions. I tried with this, but it doesn't work properly:
from typing import Callable, Any
def es_binaria(f:Callable[[Any,Any],Any]):
print("Es función binaria")
def f1(a): return a
def f2(a,b): return a+b
def f3(a,b,c): return a+b+c
es_binaria(f1)
es_binaria(f2)
es_binaria(f3)
Look the output, it accepts any kind of function!
Es función binaria
Es función binaria
Es función binaria
Please tell me how I could ensure that my function just accepts binaries functions? (for example)