Why the 'self' argument?

Terry Reedy tjreedy at udel.edu
Sat Sep 6 22:30:49 CEST 2003


"Harri Pesonen" <fuerte at sci.fi> wrote in message
news:Ucp6b.3992$ZB4.3874 at reader1.news.jippii.net...
> I agree, it's not logical.

Do my previous two responses today make the logic any clearer?

> I'm learning Python at the moment, and like it very much.

Try learning this.  Class K method attribute f with params (s, *rest)
can be called as K.f(Kinst, *rest), consistent with all other function
calls.

Abbreviation Kinst.f(*rest) makes the call look inconsistent by making
K inplicit (and moving Kinst), but the same inplicitness enables
runtime method lookup and superclass inheritance.  I think the
benefits that following are worth the minor bump in one's learning
curve.

Terry J. Reedy






More information about the Python-list mailing list