All this self dot is making me...

Konrad Hinsen hinsen at cnrs-orleans.fr
Wed Jun 2 12:10:01 CEST 1999


"Jim Rudnicki" <jdrudnicki at yahoo.com> writes:

> So what has me perplexed is why all the self. 's?  Is this a namespace issue
> or maybe just to expensive to do at runtime?

First, I find the immediate visual distinction between local variables
and object attributes helpful. Of course your opinion can differ!

Second, in the absence of variable declarations, Python has no way
to find out what is local and what is an attribute. And this isn't made
easier by the fact that attributes can be created dynamically at any
time.

> For those of us who have less cartilage left in their hands, would it be
> acceptable to use "my." or better "me."  Or is self. strongly ingrained?

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.
-- 
-------------------------------------------------------------------------------
Konrad Hinsen                            | E-Mail: hinsen at cnrs-orleans.fr
Centre de Biophysique Moleculaire (CNRS) | Tel.: +33-2.38.25.55.69
Rue Charles Sadron                       | Fax:  +33-2.38.63.15.17
45071 Orleans Cedex 2                    | Deutsch/Esperanto/English/
France                                   | Nederlands/Francais
-------------------------------------------------------------------------------




More information about the Python-list mailing list