In article <[email protected]>,
[email protected] wrote:
> Is there a simpler way to modify all arguments in a function before using the
> arguments?
>
> For example, can the below code, in the modify arguments section be made into
> a few statements?
>
> 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 (³_² , ³²)
>
> # use the arguments
> # -----------------
> #
You could do something like (not error checked)...
def someComputation(*args):
new_args = [arg.replace("_", "") for arg in args]
aa, bb, cc, dd, ee, ff, gg, hh = new_args
but that's pretty weird. I suspect you just want to pass a list instead
of a bunch of discrete arguments.
--
http://mail.python.org/mailman/listinfo/python-list