On 2007-11-22, Steven D'Aprano <[EMAIL PROTECTED]> wrote: > On Wed, 21 Nov 2007 15:51:56 -0800, braver wrote: > >> Is there any trick to get rid of having to type the annoying, >> character-eating "self." prefix everywhere in a class?
You got this highly flexible language, very good for rapid programming, no more clutter from block brackets and variable declarations, and now this 'self' pops up. So much overhead.... Can the computer not decide by itself what I want stored in the object? It can read my code too! > Oh I know! It' uch a pain. Sinc writing a hug cla lat wk, I'v had a > trribl hortag o lowrca S E L and F charactr. It mak writing vry annoying. Yes annoying isn't it? Last week I was programming in C++ again, and now I have this terrible sur-plus of lowercase T H I and S letters. I don't understand how they do it (I used to, but not any more). Maybe we should setup an exchange program so everybody can trade letters with each other. >> Sometimes I avoid OO just not to deal with its verbosity. > > There are other values than brevity. In fact, brevity is one of the less > important values. NO! You got it all wrong here! It is not about brevity, it is about SPEED. With less letters, there is less to read, so it can be read faster, so it must be better! Just like "if x:" is MUCH BETTER than "if x != 0:" The thing that should be fixed imho, is that the brain of some of us tries to deduce higher levels of abstractions from what is essentially a very long line of simple instructions. >> But things grow -- is there any metaprogramming tricks or whatnot we can >> throw on the self? > > Oh yeah, that's just what I like to see! Complicated, brittle, hard to > debug, difficult to understand metaprogramming tricks in preference to a > simple, easy-to-read naming convention. Maybe we should state first which variables we want to store in self, and then have a meta-programming hook that automatically puts assignments to those variables into the object. And while we are at it, maybe we should also state the type of data we want to put in it. That should help too. Now that would be progress. Ah well, I guess we will have to wait a while before that happens..... Albert -- http://mail.python.org/mailman/listinfo/python-list