typing a returned function in python3?

Viewed 30

Say I have a function which returns a function.

def fnA( x: int, y: int) -> function:
  def fnB(z: int) -> int:
    return x + y
  return fnB

This would allow me to do something like: fnA(3,4)(5) and it would return 12

BUT because of me not typing the function, I dont know what the definition input is and return type of fnB is. I was not sure if: function[int, int] is the way to do it where the last value is the return type or something?

How do I accomplish this? When looking at the Typing module i didnt really see anything.

0 Answers
Related