Pau*_*tos 10 python static-methods types type-hinting
如何键入返回实例对象的静态方法?
import typing
class foo(object):
@staticmethod
def getOne() -> foo:
return FooRegister().get()
Run Code Online (Sandbox Code Playgroud)
FooRegister包含 的所有实例foo。但是,如果我按所示输入它,python 会抱怨,因为foo尚未定义。
键入此内容的正确方法是什么?
| 归档时间: |
|
| 查看次数: |
1377 次 |
| 最近记录: |