+ 6

it is not necessary to have self as first parameter of every function

29th Oct 2016, 12:46 AM
Shekhar Bahuguna
Shekhar Bahuguna - avatar
2 Respostas
+ 6
That is correct. It is only necessary when the function you are writing is a method. A method is a special type of function that acts on an object of the type that your class defines.
29th Oct 2016, 11:50 AM
Brian
+ 2
another thing is the keyword used as first method parameter can be something else than self this is just a convention that most Python developer has generalized
22nd Jan 2017, 8:08 PM
thenomad
thenomad - avatar