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

vllm : Failed to infer device type

android studio kotlin source is null error

gemini cli getting file not defined error