On Wed, 17 Feb 2021 at 18:30, Ethan Furman <et...@stoneleaf.us> wrote:
> On 2/17/21 8:47 AM, Random832 wrote: > > On Tue, Feb 16, 2021, at 23:24, Stephen J. Turnbull wrote: > > >> except a couple of characters. So what currently looks like > >> > >> some_list.sort(key=lambda e: e[3].priority) > >> > >> would then be > >> > >> some_list.sort(key=(e)->e[3].priority) > > > > Let's not pretend the key argument being keyword-only isn't a wart. > Surely this would be better if it could be some_list.sort(e->e[3].priority). > > No need to pretend, it isn't a wart. > > -1 on removing the lambda keyword. Just because excessive punctuation > works for other languages does not mean it's a good fit for Python. > Just my 2c, I don't find lambda verbose at all, quite like it. But I wish Python allowed for multi-line lambda functions... somehow. Why? If you need to have a callback function that takes 2 to 5 lines of code, then (1) current lambda doesn't allow it, (2) inline named function, defined earlier, is too verbose IMHO (code style dictates it needs two blank lines, one before, one after, plus need to have a name), and also somewhat breaks the flow of reading code. A multi-line lambda would be able to fill the gap, between too big for single line lambda, but too small to justify its own def xxx(). Sorry, I don't have any concrete proposal, just a vague wish.
_______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-le...@python.org https://mail.python.org/mailman3/lists/python-ideas.python.org/ Message archived at https://mail.python.org/archives/list/python-ideas@python.org/message/PSWFL5AQLWAQSDJA2M2IMZBUPQGCL5NB/ Code of Conduct: http://python.org/psf/codeofconduct/