Origin of 'self'

Ian Kelly ian.g.kelly at gmail.com
Mon Mar 3 08:03:18 CET 2014


On Sun, Mar 2, 2014 at 11:16 PM, Westley Martínez <anikom15 at gmail.com> 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.

The idea of requiring references to attributes and methods of self to
be explicit comes from Modula-3; likely the naming convention follows
the same lineage.



More information about the Python-list mailing list