There are always tricks. If 5 characters is really too much to type, how about 2 characters "s.". Though I would recommend against that since it violates standard Python convention.
def foo( self ): becomes def foo( s ): Otherwise, if you happen to be using self.something a lot, just assign it to a variable, and use that. But be careful as that can become a lot more difficult to read/maintain than simply leaving self along to begin with. ss = self.something ss.foo() To me, using 'self' in Python is no different than using some other variable pointing to a class instance in a static C++ class function. -James > -----Original Message----- > From: [EMAIL PROTECTED] > [mailto:[EMAIL PROTECTED] > ] On Behalf Of braver > Sent: Wednesday, November 21, 2007 4:52 PM > To: python-list@python.org > Subject: the annoying, verbose self > > Is there any trick to get rid of having to type the annoying, > character-eating "self." prefix everywhere in a class? Sometimes I > avoid OO just not to deal with its verbosity. In fact, I try to use > Ruby anywhere speed is not crucial especially for @ prefix is better- > looking than self. > > But things grow -- is there any metaprogramming tricks or whatnot we > can throw on the self? > > Cheers, > Alexy > -- > http://mail.python.org/mailman/listinfo/python-list > -- http://mail.python.org/mailman/listinfo/python-list