티스토리 뷰

공부

[python] from typing import Callable

승가비 2023. 4. 21. 01:39
728x90
from typing import Callable

def my_function(func: Callable):

https://stackoverflow.com/questions/37835179/how-can-i-specify-the-function-type-in-my-type-hints

 

How can I specify the function type in my type hints?

How can I specify the type hint of a variable as a function type? There is no typing.Function, and I could not find anything in the relevant PEP, PEP 483.

stackoverflow.com

https://docs.python.org/ko/3/library/typing.html

 

typing — Support for type hints

Source code: Lib/typing.py This module provides runtime support for type hints. The most fundamental support consists of the types Any, Union, Callable, TypeVar, and Generic. For a full specificati...

docs.python.org

 

728x90
댓글