Proposal for removing self

Sion Arrowsmith siona at chiark.greenend.org.uk
Thu Aug 26 11:06:00 EDT 2004


Max M  <maxm at mxm.dk> wrote:
>You don't have to use self. You could simply use underscore '_'  instead.

When I started using Python for developing my own bits and pieces I
got into the habit of using 'I' instead of 'self'. Means pretty much
the same thing, stands out better in code, takes up less space on a
line, and is two keystrokes shorter. ...

>But other Python programmers will hate you for it ;-)

... And then stopped when I got the job of maintaining other people's
Python code and writing stuff that other people would have to use, if
not actively maintain.

Going back to look at C++ code (whoever wrote it) makes me realise
how helpful it is to have an explicit marker as to what's belongs
to a class and what doesn't. And before anyone mentions Hungarian
notation, (a) is 'self.' *really* that much more of an imposition
over 'm_'? and (b) it's not useful for distinguishing methods from
functions.

-- 
\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