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

vlad_fig vlad_fig at
Fri Apr 2 13:25:38 CEST 2010

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.someLines = []
self.someLines = someLines 

def writeStuff(self,
numberParameters = None,
Parameter1 = None,... ??? )
self.someLines .append("yes, we can %s" % self.Parameter1)
file = createfile('file')


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

Thank you,

More information about the Python-list mailing list