<div dir="auto"><div>Oops. I blame the partial editing of copy/padte on doing it on my phone. I meant this, of course:</div><div dir="auto"><br></div><div dir="auto"><span style="font-family:sans-serif">widget.register(callback=</span><span style="font-family:sans-serif">spam.eggs)</span><br><br><div class="gmail_quote" dir="auto"><div dir="ltr">On Wed, Aug 22, 2018, 1:47 PM Steven D'Aprano <<a href="mailto:steve@pearwood.info">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">On Wed, Aug 22, 2018 at 01:38:03PM -0400, David Mertz wrote:<br>
> On Wed, Aug 22, 2018, 12:40 PM Steven D'Aprano <<a href="mailto:steve@pearwood.info" target="_blank" rel="noreferrer">steve@pearwood.info</a>> wrote:<br>
> <br>
> > I believe that many people have a lot of trouble grasping the concept of<br>
> > functions as first-class values capable of being passed to other functions<br>
> > 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>
> ><br>
> <br>
> That long time is ongoing :-)<br>
> <br>
> You recently wrote in another thread:<br>
> <br>
> widget.register(callback=lambda: spam.eggs())<br>
<br>
Hah, so I did.<br>
<br>
<br>
> Instead of the slightly faster and definitely more direct:<br>
> <br>
> widget.register(callback=spam.eggs())<br>
<br>
Except that doesn't work, since you are passing the result of calling <br>
spam.eggs as the callback, instead of spam.eggs itself :-)<br>
<br>
<br>
<br>
-- <br>
Steve<br>
_______________________________________________<br>
Python-ideas mailing list<br>
<a href="mailto:Python-ideas@python.org" target="_blank" rel="noreferrer">Python-ideas@python.org</a><br>
<a href="https://mail.python.org/mailman/listinfo/python-ideas" rel="noreferrer noreferrer" target="_blank">https://mail.python.org/mailman/listinfo/python-ideas</a><br>
Code of Conduct: <a href="http://python.org/psf/codeofconduct/" rel="noreferrer noreferrer" target="_blank">http://python.org/psf/codeofconduct/</a><br>
</blockquote></div></div></div>