why self instead obj ?

Brian Elmegaard brian at rk-speed-rugby.dk
Fri Mar 7 09:43:25 CET 2003

Peter Hansen <peter at engcorp.com> writes:

> > I am beginner in Python and i wonder why the first argument of  the__init__
> > function is called "self" instead "obj" whereas self  indicates
> > the object itself .

I think a different wording would have made more sense for me, coming
from a non-objects world. I really have struggled to get used to self,
but from that viewpoint I don't think obj would be any better. 

Perhaps the reason for the confusion is that self is used 6 times in
scripts in the tutorial before it is mentioned in paragraph 5 under
Random remarks, which I (as an oop and python beginner) didn't even
try to understand. I don't think the first four paragraphs are
particularly tutorial-like, so I understand why I never came to the

Placing the convention-thing by the first use would make more sense,

However, it would also make more pythonic sense to me to call 'self', either
'thisObject' or 'thisInstance'. 

Random remarks:
It can't be a good enough reason that self is just inherited from smalltalk.

It is a too easy way out to tell every beginner that they can use
whatever name for self in their scripts. Usually you start working
from scripts already existing in the tutorial or demos, and it would
be quite cumbersome to know that you should start with renaming every
instance of self with your own favourite term.

Brian (remove the sport for mail)

More information about the Python-list mailing list