Python constructors and __init__

前端 未结 5 450
耶瑟儿~
耶瑟儿~ 2020-11-30 18:57

Why are constructors indeed called "Constructors"? What is their purpose and how are they different from methods in a class?

Also, can there be more that on

5条回答
  •  醉梦人生
    2020-11-30 19:31

    There is no notion of method overloading in Python. But you can achieve a similar effect by specifying optional and keyword arguments

提交回复
热议问题