14
Python's functools.partial() Lets You Pre-Fill A Function
(thepythoncodingstack.substack.com)
Welcome to the Python community on the programming.dev Lemmy instance!
Past
November 2023
October 2023
July 2023
August 2023
September 2023
Why? It’s not better or worse, just different. Lambdas have their use case, as does function partials and wraps.
They are different though, and the article doesn’t go into why they are different, which I think is a major omission (though a common one in articles about this subject).
The difference is that lambda functions are late binding, while partial functions are bound when they are created. This can lead to all sorts of hard to find bugs when using lambdas that are avoided by using partials.