Correct Type annotation for __init__

后端 未结 1 889
被撕碎了的回忆
被撕碎了的回忆 2021-02-05 03:10

What is the correct type annotation for a __init__ function in python?

class MyClass:
    ...

Which of the following would make mo

1条回答
  •  抹茶落季
    2021-02-05 04:02

    self should be omitted from the annotation when it is given as a comment, and __init__() should be marked as -> None. This is all specified explicitly in PEP-0484.

    0 讨论(0)
提交回复
热议问题