Svetlana Posted June 25, 2019 Share Posted June 25, 2019 There's no enough explanation to the variables used in the tutorials. For example, what is "self"? Is it an object or just a parameter? class Person: def __init__(self, name, age): self.name = name self.age = agep1 = Person("John", 36)print(p1.name)print(p1.age) Link to comment Share on other sites More sharing options...
Ingolme Posted June 25, 2019 Share Posted June 25, 2019 It is explained on this page: https://www.w3schools.com/python/python_classes.asp Quote Note: The self parameter is a reference to the current instance of the class, and is used to access variables that belong to the class. Following the note is an entire section talking about the self parameter. Link to comment Share on other sites More sharing options...
Recommended Posts
Create an account or sign in to comment
You need to be a member in order to leave a comment
Create an account
Sign up for a new account in our community. It's easy!
Register a new accountSign in
Already have an account? Sign in here.
Sign In Now