All this self dot is making me...

Michael P. Reilly arcege at shore.net
Wed Jun 2 11:12:04 EDT 1999


Kevin Dahlhausen <morse at harborcom.net> wrote:
:>Calling this parameter "self" is just convention, you can use whatever
:>you like. However, it's a convention that just about everybody follows,
:>so I'd think twice before doing something different.

: A couple of options come to mind:

: Or call it something short - s. ? - and use a (careful) global search and
: replace when  you're done with the coding.    I sometimes use this
: for long identifiers.  

: Or in VIM set up a mapping:
:  :map! s. self.

I think abbreviations would be better:
  :abbrev s. self.

The convention is to use "self".  It was the adoption of the original
object-oriented language (SmallTalk) in the early '70s.  Why did C++
change it to "this"?  I don't know.. probably just to be different.

People who are very well-versed in Python (Guido, Timbot, etc.)
probably wouldn't have a problem if someone used something other than
"self", but the average user might not.

Also from a psychological view, it might be better to start using
"self" instead of "this" to get your out of the "C++" thinking and into
a Python mode.. at least when you are programming in Python. :)

  -Arcege





More information about the Python-list mailing list