Can one partially apply the second argument of a function that takes no keyword arguments?
Take for example the python built in pow() function. xs = [1,2,3,4,5,6,7,8] from functools import partial list(map(partial(pow,2),xs)) >>> [2, 4, 8, 16, 32, 128, 256] but how would I raise the xs to the power of 2? to get [1, 4, 9, 16, 25, 49, 64] list(map(partial(pow,y=2),xs)) TypeError: pow() takes no keyword arguments I know list comprehensions would be easier.
0 upvotes
View original discussion ↗
Comments
Sign in or sign up to comment and upvote.
No comments yet.