python partial with keyword arguments

ساخت وبلاگ

Vote count: 0

I have a function that takes 3 kw parameters. I have some default values for x and y and I would like to call the function for different values of z using map. Where is run the following code I get the following error:

foo() got multiple values for keyword argument 'x'
def foo(x =1, y = 2, z = 3): print 'x:%d, y:%d, z:%d'%(x, y, z)
if __name__ == '__main__': f1 = functools.partial(foo, x= 0, y = -6) zz = range(10) res = map(f1, zz)

Is there a Pythonic way to solve this problem?

asked 16 secs ago

back soft...
ما را در سایت back soft دنبال می کنید

برچسب : python partial keyword arguments,python partial named arguments, نویسنده : استخدام کار backsoft بازدید : 246 تاريخ : سه شنبه 26 مرداد 1395 ساعت: 20:27

خبرنامه