bruceg113...@gmail.com writes: > Is there a simpler way to modify all arguments in a function before > using the arguments?
Why do you want to do that? > For example, can the below code, in the modify arguments section be > made into a few statements? Whenever someone uses that many variables one always has to ask whether a table would be better. But, for > def someComputation (aa, bb, cc, dd, ee, ff, gg, hh): > # modify arguments > # ---------------------- > aa = aa.replace (“_” , “”) > bb= bb.replace (“_” , “”) > cc = cc.replace (“_” , “”) > dd = dd.replace (“_” , “”) > ee = ee.replace (“_” , “”) > ff = ff.replace (“_” , “”) > gg = gg.replace (“_” , “”) > hh = hh.replace (“_” , “”) you could write (untested): def someComputation (aa, bb, cc, dd, ee, ff, gg, hh): def modify(s): return s.replace('_', '') aa,bb,cc,dd,ee,ff,gg,hh = \ map(modify,[aa,bb,cc,dd,ee,ff,gg,hh]) -- http://mail.python.org/mailman/listinfo/python-list