<div dir="auto">... functions as nouns...</div><br><div class="gmail_quote"><div dir="ltr">On Wed, Aug 22, 2018, 1:44 PM David Mertz <<a href="mailto:mertz@gnosis.cx">mertz@gnosis.cx</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div>This isn't trying to snipe. I have written the exact same unnecessary circumlocution in my own code hundreds of times. Hopefully most of them simplified before release, but I'm sure not all. And I "wrote the book", as one says, _Functional Programming in Python_.</div><div dir="auto"><br></div><div dir="auto">Functions as sounds is a powerful but counterintuitive concept.<br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Wed, Aug 22, 2018, 1:38 PM David Mertz <<a href="mailto:mertz@gnosis.cx" target="_blank" rel="noreferrer">mertz@gnosis.cx</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><div dir="auto"><div><div class="gmail_quote"><div dir="ltr">On Wed, Aug 22, 2018, 12:40 PM Steven D'Aprano <<a href="mailto:steve@pearwood.info" rel="noreferrer noreferrer" target="_blank">steve@pearwood.info</a>> wrote:<br></div><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">I believe that many people have a lot of trouble grasping the concept of functions as first-class values capable of being passed to other functions as data... It took me a long time to stop writing code like this:<br>
<br>
map(lambda x: len(x), sequence)<br>
<br>
instead of simply map(len, sequence). <br></blockquote></div></div><div dir="auto"><br></div><div dir="auto">That long time is ongoing :-)</div><div dir="auto"><br></div><div dir="auto">You recently wrote in another thread:</div><div dir="auto"><br></div><div dir="auto"> widget.register(callback=lambda: spam.eggs())<br></div><div dir="auto"><br></div><div dir="auto">Instead of the slightly faster and definitely more direct:</div><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif"> </span><span style="font-family:sans-serif">widget.register(callback=</span><span style="font-family:sans-serif">spam.eggs())</span><br></div><div dir="auto"><div class="gmail_quote"><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex">
</blockquote></div></div></div>
</blockquote></div></div></div>
</blockquote></div>