I think you also need return, and double space pound space qa to pass
linters:
def foo(): return 1 # noqa
Instead of
foo = lambda: 1
And this proposal:
foo(): 1
The benefit is just to get more out of the 80 characters when we want to
define a short callback.
I understand this is not a life changing proposal, but was wondering if it
was "nice enough" to be worth proposing.
Le jeu. 11 févr. 2021 à 15:43, Steven D'Aprano
On Thu, Feb 11, 2021 at 12:42:39PM +0100, J. Pic wrote:
foo(x): len(x)
Would be equivalent to:
foo = lambda x: len(x)
Would that work?
The question is not whether it would work, but whether it would be a good idea. What benefit does it give?
Just write:
def foo(x): return len(x)
and no new syntax is required.
-- Steve _______________________________________________ Python-ideas mailing list -- python-ideas@python.org To unsubscribe send an email to python-ideas-leave@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/IHLLXB... Code of Conduct: http://python.org/psf/codeofconduct/