<p dir="ltr"><br>
On 10 Oct 2014 20:07, "Chris Angelico" <<a href="mailto:rosuav@gmail.com">rosuav@gmail.com</a>> wrote:<br>
><br>
> On Fri, Oct 10, 2014 at 8:11 PM, Stephan Sahm <<a href="mailto:Stephan.Sahm@gmx.de">Stephan.Sahm@gmx.de</a>> wrote:<br>
> > I stumbled upon the builtin reduce function. It has an optional parameter<br>
> > initial, however if trying to set it like<br>
> ><br>
> > import operator as op<br>
> > reduce(op.add, range(10), initial=0)<br>
> ><br>
> > I get<br>
> ><br>
> > TypeError: reduce() takes no keyword arguments<br>
> ><br>
> ><br>
> > I think it would be really straightforward to also add keyword<br>
> > possibilities, at least to the parameter initial.<br>
><br>
> The first thing to note is that reduce(), in Python 3, is now imported<br>
> from functools; if you're working with Python 2, you won't see this<br>
> changed unless you can convince people that this is a bug to be fixed.<br>
> However, prefixing your code with "from functools import reduce"<br>
> produces the exact same result in Python 3.<br>
><br>
> The question is, though: What's the advantage? The first two arguments<br>
> are mandatory, and there's only one optional argument. Do you need to<br>
> say "initial=" on that?</p>
<p dir="ltr">Converting functools to argument clinic for 3.5 should fix it. I don't believe anyone has tackled that yet.</p>
<p dir="ltr">Cheers,<br>
Nick.<br></p>
<p dir="ltr">><br>
> ChrisA<br>
> _______________________________________________<br>
> Python-ideas mailing list<br>
> <a href="mailto:Python-ideas@python.org">Python-ideas@python.org</a><br>
> <a href="https://mail.python.org/mailman/listinfo/python-ideas">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
> Code of Conduct: <a href="http://python.org/psf/codeofconduct/">http://python.org/psf/codeofconduct/</a><br>
</p>