+ 1
Does anyone know how to describe the self parameter in object oriented programming?
I'm working on learning object oriented programming and creating classes and such in python 3. However, I am a little bit confused on why the self parameter must be used and what it really does or means when creating classes I was wondering if anyone could help me understand what self actually means and its purpose? Thank you so much! :)
4 Answers
+ 2
Thank you! This is awesome
0
And there's no difference between the terms instance and object?
0
In the example I use Instance as implying a defined unit of properties and/or methods created from a class template as defined using the 'class' keyword by the person writing the code. I understand object as a generic term for a structure either derived from a class template or derived from code using other inbuilt structural conventions of the language (dictionaries, lists, tuples).
How others use the terms in discussions of Object Orientated Programming varies depending on programming language and experience. For example
if you look at discussions relating to Javascript and OOP with it's prototype linkage model compounded with the latest addition of class keyword syntax you will often see class 'instance' and object terminology being used in a way that some argue is misleading .
So my opinion,for what it's worth, is I think you may find your understanding of the word 'instance' and 'object' change as you delve deeper into how Python is implemented as a language.