Differences Between Python and C++ Constructors

前端 未结 4 2162
攒了一身酷
攒了一身酷 2021-02-19 09:07

I\'ve been learning more about Python recently, and as I was going through the excellent Dive into Python the author noted here that the __init__ method is not tech

4条回答
  •  南笙
    南笙 (楼主)
    2021-02-19 09:36

    A constructor in many other languages allocates space for the object being constructed; in Python this is the job of the allocator method, __new__(). __init__() is just an initializer method.

提交回复
热议问题