History of 'self' and why not at least 'my'?

Mark McEahern marklists at mceahern.com
Fri Jan 11 09:34:39 EST 2002


Wow, great point.  Allow me to expand further:

Typing 'my' is somewhat awkward, since you have to use the right index
finger twice, moving it from 'm' to 'y', neither of which is the resting key
for that finger.  Perhaps the convention should simply be 'h' since that's
where your index finger already is:

 def meth(h,x,y,z):
   ...
   h.x=1
   h.y=1

Indeed, why 'meth'.  I would propose 'm'--but we've already been there:

  def h(h,x,y,z):
    h.x=x
    h.y=y

Now that's more like it.

In fact, we can save even more work for our fingers if we do this:

  def h(h,*a):
    h.a=a
    h.s=s
    h.d=d

Perhaps 'def' itself is due for some optimization:

  d h(h,*a):
    h.a=a
    h.s=s
    h.d=d

But is *a even necessary?  Perhaps the default should be that positional
arguments are implicitly accessible via the most easily typed letters?  In
fact, we can skip the entire next step of optimization if we just assume
that positional arguments go into the instance h's dict:

  d h(h):pass

Apply some optimization to 'pass'--that's way too much to type:

  d h(h):l

'l' is a resting key.

Surely that's far easier to type than your proposal?

is-self-really-all-that-bad'ly yours,

// mark





More information about the Python-list mailing list