Comment by throwitaway1123
Comment by throwitaway1123 3 days ago
If a callback function gets really unwieldy then you should probably extract it from the call site and define it elsewhere, but that should happen because you decided to, not because the language's limitations coerced you into doing it. The lambda restrictions in Python are probably due to the complexities of parsing indentation based languages, and the clean code argument is just a helpful rationalization. I've never woken up in angst over the fact that I wrote a callback function with two statements in it.
There may be a few restrictions due to complexity, but lambdas isn't one. This is about decent and sane design choice[0] for readability.
[0] https://www.artima.com/weblogs/viewpost.jsp?thread=147358