[Tutor] The meaning of self
Alan Gauld
alan.gauld at btinternet.com
Wed Oct 23 19:20:52 CEST 2013
On 23/10/13 17:01, Glenn Lester wrote:
> I have come across the term "self" in a number of Python scripts and as
> a beginner to the language I am wondering if it has any specific
> meaning.
Technically no, the name is arbitrary but self is used by (very strong)
tradition. As to what it is used for the explanation depends on your
background. If you already know languages like C++, Java or JavaScript
then the simple explanation is that self is the equivalent of 'this' in
those languages except Python requires yopu to explicitly specify it as
the first parameter in any method. The other languages do this implicitly.
If you don;t know those other languages then can I suggest you try
reading my explanation in my tutorial here...
http://www.alan-g.me.uk/l2p/tutclass.htm
About 15-20% of the way down there is a heading 'What is self?'
If that still makes no sense then come back and ask again, ideally with
some more specific aspects to the bits that puzzle you.
--
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.flickr.com/photos/alangauldphotos
More information about the Tutor
mailing list