python function as parameters

 An example of passing in a function as a parameter. Also notice that we have define typings. 

from typing import Callable

def hello(x):
    return x.upper()

def a(func: Callable[[str], str]):
    print(func("abc"))

a(hello)


Comments

Popular posts from this blog

The specified initialization vector (IV) does not match the block size for this algorithm