com_addbyte

etsang at my-deja.com etsang at my-deja.com
Wed Nov 1 18:52:26 EST 2000


Hi, but is it possible to somehow set default of a particular argument
list. Since it is  long arg list and there a couple functions using
with each need to modify the list for its needs. So how can I:
1. set a default argument list and have each calling func to decide
which parameter it wants to use default values or not?
2. calling function just supply the parameters that need tobe changed
Can this be done in agr list?


In article <m3d7gffuas.fsf at atrus.jesus.cam.ac.uk>,
  Michael Hudson <mwh21 at cam.ac.uk> wrote:
> etsang at my-deja.com writes:
>
> > Hi all,
> >
> > Since I am not entitled to display source code outside, I am not
able
> > to give the source code out. But here is something that I have
found:
> >
> > there is a function which takes in more than 255 parameters, and
once
> > that number of parameters are reduced, Python does not complain
anymore.
> >
> > So is there a way to get around that?
>
> Note that the problem is at the call site.  You can perfectly happily
> define functions with 1000 parameters (I've just tried it...), but you
> can't call it like:
>
> f(arg0,arg1,...,arg1000)
>
> call it like this instead:
>
> f(*(arg0,arg1,...,arg1000))
>
> or (if you're stuck with 1.5.2):
>
> apply(f,(arg0,arg1,...,arg1000))
>
> (if you're machine-generating the code, this shouldn't be too hard).
>
> HTH,
> M.
>
> --
>   Java is a WORA language! (Write Once, Run Away)
>                 	-- James Vandenberg (on progstone at egroups.com)
>                            & quoted by David Rush on comp.lang.scheme
>


Sent via Deja.com http://www.deja.com/
Before you buy.



More information about the Python-list mailing list