stef wrote: > > why should I use *args, > as in my ignorance, > making use of a list (or tupple) works just as well, > and is more flexible in it's calling. > So the simple conclusion might be: never use "*args", > or am I overlooking something ?
Yup. For example decorators, that wrap functions. If you do that, you want to return a function that captures all passed arguments, does something, and then invokes the original function with the original arguments. Like this: def logging_decorator(f): def _f(*args, **kwargs): print "calling %r with (%r, %r)", % (f, args, kwargs) return f(*args, **kwargs) return _f @logging_decorator def im_just_a_function(some, argument, and, other=None): pass Diez -- http://mail.python.org/mailman/listinfo/python-list