to thine own SELF be true...
duncan.booth at invalid.invalid
Fri May 5 19:40:08 CEST 2006
Mark Harrison wrote:
> For example, in my brain I'm thinking:
> optc,args=getopt.getopt(args,cmdopts[cmd], cmdopts[cmd])
> but I'm having to type:
> Is there a way to get rid of those the "self." references, or is this
> just something I need to get my brain to accept?
I would wonder why it is that all of those need to be attributes on self.
Are you sure you aren't storing too many things as attributes?
Trying to guess some context around that code, I would expect something
def docommand(self, cmd, args):
opts, longopts = self.cmdopts[cmd]
optc, args = getopt.getopt(args, opts, longopts)
return self.getAction(cmd)(optc, args)
or in other words a lot fewer uses of self.
More information about the Python-list