0

I understand that self allows a method to act on specific data member of a class instance, but why is it necessary that self is included as a function parameter? Why is it not just a keyword like 'this' in C++?

Izzo
  • 4,461
  • 13
  • 45
  • 82

1 Answers1

3

It's just a personal preference of the language designer. Neither way is more correct than the other. But Python tends toward making things explicit, so you see design decisions tilting in this direction.

John Zwinck
  • 239,568
  • 38
  • 324
  • 436