How the instance method works in the Python class
This article introduces how the example method works in the Python class, the content is very detailed, interested friends can refer to, hope to be helpful to you.
In OO (object-oriented) programming, there are many forms of methods in a class: instance methods, static methods, class methods, and even abstract methods. Xiaobian will talk about how instance methods work in Python, and then talk about other methods.
Let's first define the simplest class:
Class Person:
Def _ _ init__ (self, name):
Self.name = name
Def eat (self):
Print (self) #