On 2/23/21 5:01 PM, Rob Cliffe via Python-ideas wrote: > > > On 23/02/2021 17:46, Stéfane Fermigier wrote: >> >> >> On Tue, Feb 23, 2021 at 6:13 PM Richard Damon >> <rich...@damon-family.org <mailto:rich...@damon-family.org>> wrote: >> >> >> Also note, that I am not saying that 'arrow-functions' can't happen, >> just that if they are created, a natural consequence is that, >> like with >> .format(), the 'old' (lambda) way will need to be marked as >> 'old', and >> not the current obvious way. >> >> >> If there is a consensus that arrows are better enough that lambdas, >> and arrows happen, lambdas will be considered 'old' and automated >> converters such as pyupgrade will be quick to replace lambdas (and >> people publishing libraries will have to wait until the EOL of the >> older versions of Python before being able to run it). >> >> And if, otherwise, there is no such consensus, the change will never >> happen. >> >> Same as u"xxx" versus Unicode("xxx"), x**y vs pow(x, y), x @ y >> vs. matmul(x, y), etc. >> >> S. >> > As far as I know, there is no case of valid syntax using 'lambda' > where replacing 'lambda' by 'def' results in valid syntax. > Can anyone provide a counter-example? > If not, I would support allowing 'def' as an alternative to 'lambda' > (allowing 'def' to ultimately become the recommended usage). > (I'm -0.5 on adding an alternative arrow syntax, but that's a purely > subjective opinion.) > Rob Cliffe
My one thought is that if one issue with making a multi-statement lambda is that the parser can't tell if it needs a statement block or an expression (for current lambda), that def in this format could be the syntax to get to the multi-statement 'lambda'. -- Richard Damon _______________________________________________ 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/OBQGB6QHKKMW3A5ZTFEOG4APO677ID43/ Code of Conduct: http://python.org/psf/codeofconduct/