Too many 'self' in python.That's a big flaw in this language.

Sion Arrowsmith siona at chiark.greenend.org.uk
Wed Jun 27 09:50:03 EDT 2007


Neil Cerutti  <horpner at yahoo.com> wrote:
>On 2007-06-27, hide1713 at gmail.com <hide1713 at gmail.com> wrote:
>> From My point,I think this only help python interpreter to
>> deside where to look for. Is there anyone know's how to make
>> the interpreter find instance name space first? Or any way to
>> make programmer's life easier?
>Try thinking of "self." as a notation that provides vital
>information to you, the programmer.

And it provides even more vital information to *other* programmers
dealing with your code ("other" including "you in six months time").
I've just confused the socks off a cow-orker by writing in a C++
method kill(SIGTERM); -- confusion which would have been avoided if
I'd used an explicit this->kill(SIGTERM); . But amongst C++'s many
flaws, such disambiguation is frowned on as non-idiomatic. Explicit
self *is a good thing*.

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