Why the 'self' argument?

Grant Edwards grante at visi.com
Fri Sep 5 19:32:56 EDT 2003


In article <vli387c9mm140a at news.supernews.com>, John Roth wrote:

>> So that there's no difference between a function and a method.
>>
>> Simplicity and orthogonality are good things -- despite what
>> C++ proponents thing.
>>
>> > Hence my comment that requiring it is more complex than not
>> > requiring it.
>>
>> No, it's more complex the Java/Ruby way, since you have to have
>> two sets of rules for what a name means depending on whether
>> you're inside a "normal" function or a method.  In Python
>> there's just one set of rules -- mostly.
> 
> As I said earlier, it's quite possible to define it so that there
> is always an instance of some kind; whether that's an instance
> a class or the module itself.

I don't follow.  You're talking about defining a keyword that
always refers to the first parameter passed to a function?  And
the declared parameters would refer to the 2nd through Nth
parameters?  What if the keyword isn't used in the function
definition, then do the delcared parameters refer to the 1st
through Nth?

> I think my comments have shown that you can reduce the amount
> of scoping / name space rules noticably.

Compared to what?  It sure sounds like you're introducing more
rules than there are now.  How would you propose reducing the
number of rules?

-- 
Grant Edwards                   grante             Yow!  Somewhere in Tenafly,
                                  at               New Jersey, a chiropractor
                               visi.com            is viewing "Leave it to
                                                   Beaver"!




More information about the Python-list mailing list