On Thu, 05 Jan 2006 23:52:13 -0800, Paul Rubin wrote: > [EMAIL PROTECTED] writes: >> def izip4(*iterables, **kw): >> """kw:fill. An element that will pad the shorter iterable >> kw:infinite. Number of non-terminating iterators """ > > That's a really kludgy API. I'm not sure what to propose instead: > maybe some way of distinguishing which iterables are supposed to be > iterated til exhaustion (untested): > > class Discardable(object): pass > > def izip5(*iterables, fill=None):
Doesn't work: keyword arguments must be listed before * and ** arguments. >>> def izip5(*iterables, fill=None): File "<stdin>", line 1 def izip5(*iterables, fill=None): ^ SyntaxError: invalid syntax Personally, I don't see anything wrong with an API of function(*iterators [, fill]): Perform function on one or more iterators, with an optional fill object. Of course, this has to be defined in code as: def function(*iterators, **kwargs): if kwargs.keys() != ["fill"]: raise ValueError ... It might not be the easiest API to extend, but for a special case like this, I think it is perfectly usable. -- Steven. -- http://mail.python.org/mailman/listinfo/python-list