functools.partial doesn't work without using named parameter

Ian Kelly ian.g.kelly at gmail.com
Fri Mar 25 03:08:14 EDT 2011


On Fri, Mar 25, 2011 at 1:03 AM, Ian Kelly <ian.g.kelly at gmail.com> wrote:
> Moral of the story: if you pass in an argument by keyword, then the
> following arguments must be passed by keyword as well (or not at all),
> regardless of whether you're using partial or not.

To be clear, you can also just pass f1 into partial positionally, like so:

>>> fsf1 = partial(fs, f1)
>>> fsf1(s)
[0, 2, 4, 6]
>>> fsf1(s=s)
[0, 2, 4, 6]



More information about the Python-list mailing list