Jun 16, 2024
I gave you claps, but you missed the bigger and more general picture - you can turn any Python function into a single line!
A demo is here. It handles some difficult cases like classes. It doesn't handle context managers correctly, but this can also be accomplished, though not so easily. (I didn't write this, I just saw it a few years ago.)