Re: def method with variable no of parameters file.writeStuff(n, a1, a2, ...an)

2010-04-04 Thread alex23
"vlad_fig" wrote: > file.writeStuff(2,a1,a2) > file.writeStuff(3,a1,a2,a3) > > file.writeStuff(n,a1,a2,...an) > --- > so i want a method i can call based on the number of parameters > n , and that allows me to add these extra parameters based on n It's not necessary to have to specify the nu

Re: def method with variable no of parameters file.writeStuff(n, a1, a2, ...an)

2010-04-04 Thread Joaquin Abian
On Apr 2, 1:25 pm, "vlad_fig" wrote: > Hello all, > > I would like some help with setting up a method that would allow me to change > its number of parameters. For example: > > #- > class createfile(object): > > def __init__(self, > modelName = None, > someLines = None): > > s

Re: def method with variable no of parameters file.writeStuff(n, a1, a2, ...an)

2010-04-04 Thread Iuri
What you need is var-args: def func(*args): for arg in args: print arg func(1,2,3,4) On Fri, Apr 2, 2010 at 8:25 AM, vlad_fig wrote: > Hello all, > > I would like some help with setting up a method that would allow me to > change its number of parameters. For example: > > #

def method with variable no of parameters file.writeStuff(n, a1, a2, ...an)

2010-04-04 Thread vlad_fig
Hello all, I would like some help with setting up a method that would allow me to change its number of parameters. For example: #- class createfile(object): def __init__(self, modelName = None, someLines = None): self.modelName = modelName if someLines is None: self.someL