-3

enter image description here

What is the self parameter? Because I looked at the documentation and it only mentions x and y as parameters.

Tarun Kolla
  • 917
  • 1
  • 10
  • 30
NoName
  • 9,824
  • 5
  • 32
  • 52
  • You'll want to do some reading into methods. All methods like that have a first implicit parameter `self` that's the instance. You may want to take a step back and focus on learning deeper before going into graphics. – Carcigenicate Sep 03 '19 at 02:06

1 Answers1

1

In Python, the declaration of any method of a class has the parameter self, which is a reference to the current instance of the class. That's what allows you to access the variables and methods in this scope.

More info here.

Telmo Trooper
  • 4,993
  • 1
  • 30
  • 35
  • So do I have to explicitly put "self" as the first parameter when declaring or calling? – NoName Sep 03 '19 at 02:20
  • When declaring a method inside a class yes, when calling it no (it's implicit). – Telmo Trooper Sep 03 '19 at 02:20
  • 1
    Okay, thanks. I found a good read for anyone else having trouble understanding: https://medium.com/quick-code/understanding-self-in-python-a3704319e5f0 – NoName Sep 03 '19 at 02:26