3 ms·
I also don't understand why people use lambda like: myfunction( lambda a: a.foo > a.bar ) I think the following looks neater: aname = lambda a: a.foo > a
by SapphireSun 18y ago
I also don't understand why people use lambda like:
myfunction( lambda a: a.foo > a.bar )
I think the following looks neater:
aname = lambda a: a.foo > a.bar
myfunction( aname )
I think that putting unnecessary clutter inside of a function call is just asking for readability problems.
- sofal 18y agoIf you explored outside of your boundaries and learned different ways of programming (like functional programming), you might realize that there are perfectly valid styles of programming where lambdas are as common as if-statements and for-loops. I think that it is reasonable to assume that creating named local variables for each and every one of them would be silly.
- jrockway 18y agoTo be fair to the grandparent, Python goes out of its way to discourage use of functional programming techniques.