If you use named arguments, partial
returns a function with a signature with those arguments set as if they were the defaults.
However, if you use positional arguments, partial
returns a function with all but the arguments set positionally.
def my_func(start, end, pos):
pass
f = partial(my_func, 0, 1) # => f(pos)
f = partial(my_func, start=0, end=1) #=> f(start=0, end=1, pos)
It was bothering me when in Lesson 9, Jeremy showed how to use partial in a way that made the arguments look like they had disappeared.