- くだすれPython(超初心者用) その27©2ch.net
370 :デフォルトの名無しさん[sage]:2015/10/03(土) 11:04:10.76 ID:tCbgZp8x - 自分自身を返す関数のとき,アノテーションはどうかけばいいですか?
クラス名を書くとエラーになってしまいます class Test: def func(self) -> Test: return self Test().func() Traceback (most recent call last): File "a.py", line 2, in <module> class Test: File "a.py", line 3, in Test def func(self) -> Test: NameError: name 'Test' is not defined
|