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

Paul Rubin http
Wed Oct 4 13:39:18 CEST 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