python3 typing 部分测试学习

# https://docs.python.org/zh-cn/3/library/typing.html
# https://docs.python.org/3/library/typing.html#module-typing
from typing import List,Tuple,Union,Any,ClassVar,Callable

def py3test(a:int, b:int or str, c:List[str or int]=None) -> Tuple[str, Union[bool,str]]:
	name:str = 'a'
	flag:bool = True
	return (name, flag)

def py3test2(a:int=None,b:str=None) -> Any:...

class A:...

def py3test3(func:Callable[[int, str], Any], a:A=None) -> Any:
	print(func, a, sep='\n')

if __name__ == '__main__':
	py3test3(py3test2, A())

你可能感兴趣的:(笔记)