itertools.izip brokeness

Paul Rubin http
Fri Jan 6 04:57:43 EST 2006


Steven D'Aprano <steve at REMOVETHIScyber.com.au> writes:
> >     def izip5(*iterables, fill=None):
> Doesn't work: keyword arguments must be listed before * and ** arguments.

Eh, ok, gotta use **kw.

> 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.

Yeah, that's what the earlier version had.  I tried to bypass it but
as you pointed out, it's a syntax error.  The code I posted also has a
deliberate syntax error (until Python 2.5), namely the use of the new
conditional expression syntax (PEP 308).  That could be worked around
of course.



More information about the Python-list mailing list