0

Can anyone explain what functools.partial do?

16th Feb 2020, 4:38 AM
rb kdk
rb kdk - avatar
3 Answers
+ 2
partial() can be used to sort of hard-code some default arguments when calling a function. I meddled with it in this code: https://code.sololearn.com/cBZ8CthiaJ8h/?ref=app It could be useful also if you have a function that takes two arguments, and you have to use it in a situation where a function with a single argument is expected, as in parameter of higher order functions like filter, map, reduce.
16th Feb 2020, 5:09 AM
Tibor Santa
Tibor Santa - avatar
0
I did got some examples but not clear yet. I understand it shortens some effort by merging key args?
16th Feb 2020, 4:43 AM
rb kdk
rb kdk - avatar
0
I did got some examples but not clear yet. I understand it shortens some effort by merging key args?
16th Feb 2020, 4:43 AM
rb kdk
rb kdk - avatar