Origin of 'self'

Steven D'Aprano steve at pearwood.info
Mon Mar 3 01:52:40 EST 2014


On Sun, 02 Mar 2014 22:16:31 -0800, Westley Martínez wrote:

> I understand that in an object method the first argument in the object
> itself, called self.  However, it doesn't have to be called self, and
> can be called anything.  So my question is why is it called self and not
> this like from C++ and Java.  It's kind of a silly question, but one
> that I'm curious about nevertheless.

A better question is why C++ and Java used "this" instead of "self" like 
Smalltalk. It's fairly clear that Java copied C++, but why did C++ use 
"this"?


http://en.wikipedia.org/wiki/Comparison_of_programming_languages_%28object-oriented_programming%29#Special_variables


As far as I can tell, Simula 67 (the first OOP programming language) 
doesn't seem to use a standard name for the current instance, it appears 
to be unneeded. But Simula 67 was the inspiration for Smalltalk, invented 
by Alan Kay at Xerox PARC in the 1970s, and Smalltalk used "self". 
Virtually everything in OOP that followed was influenced by or derived 
from Smalltalk.



-- 
Steven



More information about the Python-list mailing list