Python的__init__和self是作什么的? - What __init__ and self do on Python?

问题:

I'm learning the Python programming language and I've came across something I don't fully understand. 我正在学习Python编程语言,遇到了一些我不太了解的东西。 编程

In a method like: 用相似的方法: 编程语言

def method(self, blah):
    def __init__(?):
        ....
    ....

What does self do? self作什么的? What is it meant to be? 这是什么意思? Is it mandatory? 它是强制性的吗? 学习

What does the __init__ method do? __init__方法有什么做用? Why is it necessary? 为何有必要? (etc.) (等等。) spa

I think they might be OOP constructs, but I don't know very much. 我认为它们多是OOP构造,但我不太了解。 .net


解决方案:

参考一: https://stackoom.com/question/2cbz/Python的-init-和self是作什么的
参考二: https://oldbug.net/q/2cbz/What-init-and-self-do-on-Python
相关文章
相关标签/搜索