Plenty of π
Module 5: Introduction to Object-Oriented Programming (OOP)
Creating Classes: `class`, `__init__`, and `self`
  • class keyword: Used to define a new class.

    class Dog:
      pass  # pass means 'do nothing', a placeholder
    
  • __init__ method (Constructor): A special method that is automatically called when you create a new object (instance) of a class. It's used to initialize the object's attributes. The name __init__ has double underscores before and after.

  • self parameter: The first parameter of any method within a class (including __init__) is conventionally named self. It refers to the instance of the class itself. Through self, methods can access the attributes and other methods of the same object.