[Tutor] variable length methods?

Denis Saussus dsaussus at jasongeo.com
Fri Jan 16 06:35:35 EST 2004


Hello,

I would like to know if there is a special python version of *vargs
specifically intended to be used with variable length methods instead
of just with variable length arguments.  If there is, fantastic!  If
there isn't, is it still acceptable to 'fudge' *vargs to do what I want?

For instance,

class MyClass:
  def __init__(self, outputdir, *vargs):
    ...

will work without any problems if you do:

MyClass mc(outputdir = 'here/',
           a = 1,
           b = 2,
           c = 4,
           ...)

but what I am seeking to do is:

MyClass mc(outputdir = 'here/',
           plot(x),
           plot(a,b,c),
           plot(w,z),
           ...)

where,

def plot(*vargs):
   ...

Help anyone?

Thanks!



More information about the Tutor mailing list