Re: html documentation and question about Stevens objects

Tim Peters (tim@ksr.com)
Fri, 11 Feb 94 19:48:24 EST

> [guido]
> ... If you are referring to leaving "self" out of method definitions,
> that won't happen -- I considered it for a while but decided it
> wouldn't lead to more clarity in Python code.

Indeed, every time I overload an operator for a C++ class, I _cringe_
inside because I have to declare it with the "wrong" number of arguments.
E.g.,

inline uint64&
uint64::operator += (uint64 &y)
{
*this = *this + y;
return *this;
}

or

inline uint64
uint64::operator ~ ()
{
uint64 result( ~lo );
result.hi = ~hi;
return result;
}

Regardless of language convention, in reality "+=" needs two arguments
and "~" needs one ... and "object.method(x,y,z)" needs four <wink>.

I really don't appreciate C++ magically initializing the magic "this"
variable for me, and positively hate that it then goes on to (in effect)
magically prepend "this->" to instances of the object's attributes'
names (I hate it a month later, when I'm trying to figure out what the
code thinks it's doing ...).

Miale's thesis didn't suggest the latter (thanks, Steve <smile>!), but I
think overstated the virtue of the former. Seems to me that the only
clear benefit in changing Python to magically set a magic "self" variable
would be to meet autopilot expectations derived from prior experience
with other languages. That's never a great argument, although it's often
a decent one. Are there other benefits?

happy-the-way-it-is-ly y'rs - tim

Tim Peters tim@ksr.com
not speaking for Kendall Square Research Corp