braver wrote: > 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?
The most common answer you are going to get is that explicit is better than implicit, which I tend to agree with. Some people use 's' instead of 'self'. This shortens the number of characters you have to type, and is only one character more than the Ruby '@' prefix. Here is a metaprogramming technique that removes self, but I don't recommend these sorts of things, especially if other people are going to be looking at your code in the future. So use it at your own risk! http://aspn.activestate.com/ASPN/Cookbook/Python/Recipe/362305 -Farshid -- http://mail.python.org/mailman/listinfo/python-list