Why we use self in python | Sololearn: Learn to code for FREE!
New course! Every coder should learn Generative AI!
Try a free lesson
+ 2

Why we use self in python

I didn't know much about it

10th Sep 2017, 4:09 AM
Ankit
Ankit - avatar
1 Answer
+ 8
It can be anything, not just 'self' - it's just a convention to use self to be coherent worldwide. Anyhow, the idea is that the first argument of a class instance method, when defining, refers to the particular object itself.
10th Sep 2017, 5:50 AM
Kuba Siekierzyński
Kuba Siekierzyński - avatar