In <[email protected]> "T. 
Goodchild" <[email protected]> writes:

> So why is 'self' necessary on class methods?  It seems to me that the
> most common practice is that class methods *almost always* operate on
> the instance that called them.  It would make more sense to me if this
> was assumed by default, and for "static" methods (methods that are
> part of a class, but never associated with a specific instance) to be
> labelled instead.

> Just curious about the rationale behind this part of the language.

How would a method access instance variables without 'self'?

They probably could have made 'self' a magical attribute that just
appears out of thin air instead of being passed as an argument, like
'this' in C++.  But would that really provide any benefit?

-- 
John Gordon                   A is for Amy, who fell down the stairs
[email protected]              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to