What value should be passed to make a function use the defaultargument value?

Paul Rubin http
Wed Oct 4 07:39:18 EDT 2006


Antoon Pardon <apardon at forel.vub.ac.be> writes:
> I think it would become something like:
> 
>   def myrepeat(*args):
>     obj = args[0]
>     tail = args[1:]
>     newobj = Process(obj)
>     newargs = (newobj,) + tail
>     return itertools.repeat(*newargs)

Too messy.  Just write:

  def myrepeat(obj, *times):
    return itertools.repeat(Process(obj), *times)



More information about the Python-list mailing list