On Tue, Jul 29, 2008 at 6:19 PM, Raymond Hettinger <[EMAIL PROTECTED]> wrote:
>>> With keyword-only parameters allowed now, I think it makes sense to be able
>>> to supply the keywords arguments after the variable length argument as
>>> well.
>>
>> Agreed. I doubt that this will be a simple enough change to allow it
>> in 3.0 though.
>
> Sure would be nice if it could go in. IMO, the functionality is an essential
> companion to keyword-only parameters.
> Looking at the Py2.6 version of the same itertools recipe, the workaround is
> somewhat unattractive:
>
>   def grouper(n, iterable, fillvalue=None):
>       "grouper(3, 'abcdefg', 'x') --> abc def gxx"
>       args = [iter(iterable)] * n
>       kwds = dict(fillvalue=fillvalue)
>       return izip_longest(*args, **kwds)

If you reverse the two parts it will work:

  izip_longest(fillvalue=fillvalue, *args)

This works in 2.6 and 3.0. It would be nice to allow the other order
too, I know it's tripped me up... But the syntax would become really
tricky. So let's strive to fix this for 3.1 rather than introduce
instability in such a subtle area of the code this late in the game.

-- 
--Guido van Rossum (home page: http://www.python.org/~guido/)
_______________________________________________
Python-3000 mailing list
Python-3000@python.org
http://mail.python.org/mailman/listinfo/python-3000
Unsubscribe: 
http://mail.python.org/mailman/options/python-3000/archive%40mail-archive.com

Reply via email to