我希望给 class 做个 typing hint ,但是貌似只能写 type ?
但是 type 过于宽泛了
from loguru import logger
class MyClass:
def __init__(self, name: str, data: dict[str, int | str]) -> None:
pass
def func(cls: type):
pass
func(MyClass)
比如我有一个 func 函数,接受的参数是一个 class,我希望给该参数 cls,添加一个『准确』的 typing hint,除了 cls:type
还有其他选择吗?