Origin of 'self'

Dave Angel davea at davea.name
Mon Mar 3 01:49:04 EST 2014


 Westley Martínez <anikom15 at gmail.com> Wrote in message:
> 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.
> 

I couldn't tell you the history,  but I can say it makes sense to
 me. In c++, this is a pointer,  and the name this seems
 reasonable.  But in python it's a reference,  a reference to
 myself. 

-- 
DaveA




More information about the Python-list mailing list