Why self?
Grant Edwards
grante at visi.com
Thu Jul 11 19:08:06 EDT 2002
In article <zcoW8.626783$%y.39202464 at bin4.nnrp.aus1.giganews.com>, Terry Reedy wrote:
>
> "Robb Shecter" <rs at onsitetech.com> wrote in message
> news:3D29CE9D.4000802 at onsitetech.com...
>> Matt Gerrans wrote:
>> I completely agree, but I think the situation's even worse than you
>> described: A'typical' case of standard OO programming is made the
> most
>> tedious to write: References to instance variables from methods:
>>
>> self.__velocity = self.__factor1 * self.__factor2
>>
>> etc. I find this totally unreadable (7 extra characters per
> referenced
>> instance variable).
>
> Only 2 'extra' chars are needed -- a letter and '.'. Why the extra
> '__'?
Thy're "private" instance variables. Whereas other languages
provide a declaration for such a propterty, you get a similar
result in Python by mangling the name...
--
Grant Edwards grante Yow! Is something VIOLENT
at going to happen to a
visi.com GARBAGE CAN?
More information about the Python-list
mailing list