I created this class earlier.
class Dog():
"""A simple attempt to model a dog."""
def __init__(self, name, age):
"""Initialise name and age attributes."""
self.name = name
self.age = age
def sit(self):
"""Simulate a dog sitting in response to a command."""
print(self.name.title() + " is now sitting.")
Now, the book I am reading says the following
Because these methods don’t need additional information like a name or age, we just define them to have one parameter, self.
I'm confused by what this means.
Does this mean that when we pass the parameter self, the method has automatic access to the attributes self.name and self.age?
The book in question is Python Crash Course by Eric Mattes.