3 ms·
Your original function name is pretty terrible and your alternative is an artificially bad example. If Lvalue implies variable (and possibly variable implies l
by wvenable 17y ago
Your original function name is pretty terrible and your alternative is an artificially bad example. If Lvalue implies variable (and possibly variable implies lvalue) then both are not necessary in the name. Var will be universally understood but Glo and Lv would stump anyone not familiar with your personal shorthand. The word lookup is unnecessary. You can still get something quite self-documenting and not all that verbose or long:
def getGlobalVar(self, varName):
def getGlobalLvalue(self, varName):
def varLookupGlobal(self, varName):
def lookupGlobalLvalue(self, varName):
def globalLvalue(self, varName):
...
Nobody says you need to go all Java and make your variable names stupidly long. But small measures towards readability can go a long way to making code self-documenting and easier to understand.
- cabalamat 17y ago> If Lvalue implies variable Lvalue implies something that goes on the left side of an assign statement. An lvalue needn't be a variable, it could be a whole expression, E.g.: a := b; c[x] := d.y; Here, a and c[x] are lvalues. b and d.y are rvalues.
- wvenable 17y agoRight, but in the context of your function an expression is not possible -- you are passing a variable name to a lookup function.