In <0dc26f12-2541-4d41-8678-4fa53f347...@g9g2000yqb.googlegroups.com> "T. 
Goodchild" <tgoodch...@gmail.com> 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
gor...@panix.com              B is for Basil, assaulted by bears
                                -- Edward Gorey, "The Gashlycrumb Tinies"

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

Reply via email to