What is "self"?

Sion Arrowsmith siona at chiark.greenend.org.uk
Fri Sep 23 16:30:35 CEST 2005


Rick Wotnaz  <desparn at wtf.com> wrote:
>I've long thought that Guido missed an opportunity by not choosing 
>to use 'i' as the instance identifier, and making it a reserved 
>word. For one thing, it would resonate with the personal pronoun 
>'I', and so carry essentially the same meaning as 'self'. It could 
>also be understood as an initialism for 'instance'. And, because it 
>is shorter, the number of objections to its existence *might* have 
>been smaller than seems to be the case with 'self' as the 
>convention.

My first serious forays into Python, where no-one else was expected
to be maintaining the code, used 'I' instead of 'self' -- it's
shorter, stands out better, and 'I.do_something()' reads more like
English than 'self.do_something()' (unless, I suppose, you're
thinking in terms of message passing). Then I started working on
code which other people might need to look at, and got an editor
whose Python syntax highlighting pretended that 'self' was a
reserved word, and now all my old code looks odd. (But still
perfectly readable -- this is Python after all.)

-- 
\S -- siona at chiark.greenend.org.uk -- http://www.chaos.org.uk/~sion/
  ___  |  "Frankly I have no feelings towards penguins one way or the other"
  \X/  |    -- Arthur C. Clarke
   her nu becomeþ se bera eadward ofdun hlæddre heafdes bæce bump bump bump



More information about the Python-list mailing list