shortcut for 'self' wish

Costas Menico costas at meezon.com
Fri Mar 2 21:09:50 EST 2001


It would be nice if there was someway to cut down on the typing of
self.something inside def methods.

 VB and other languages you are allowed to define a 'WITH' prefix so
all you type is the dot followed by the method/property.E.g.

with this
  .edit
     < more stuff here >
  .update
endwith

Since Python lets you declare your own self it maybe better to change
the 'self' to a single letter standard.  Maybe m.property or m.method
would be a good one.

so instead of

def myMethod(self, arg1, arg2):

we could have

def myMethod(m, arg1, arg2):

This would save a lot of typing and encourage using OOP more,

Any other ideas? Does anyone have experience with this?

Costas





More information about the Python-list mailing list