gpt4 book ai didi

python - 我应该为方法 `self` 参数使用什么类型?

转载 作者:太空宇宙 更新时间:2023-11-04 00:46:43 25 4
gpt4 key购买 nike

如果我在我的项目中使用 mypy,我的方法自身对象应该是什么类型?

from typing import List

class Example:
def __init__(self, arg1: List[str]) -> None:
pass

最佳答案

没什么,保持原样。

这是我从他们的文档中可以看出的: https://mypy.readthedocs.io/en/latest/class_basics.html?highlight=self

关于python - 我应该为方法 `self` 参数使用什么类型?,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/39238475/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com