[issue33447] Asynchronous lambda syntax
Terry J. Reedy
report at bugs.python.org
Fri May 18 17:44:04 EDT 2018
Terry J. Reedy <tjreedy at udel.edu> added the comment:
The only thing special about functions defined with lambda expressions rather than def statements is the generic name attribute '<lambda>' instead of a specific name. PEP8 intentionally and properly discourages 'name = lambda ...' as inferior to 'def name(...'.
For your example,
async def foo(a, b): return 5 + await bar(b)
For inline function expressions, as in function calls, the obvious proposals would be to reuse 'async' in f(async lambda a, b: ...) or a new keyword, such as 'alambda' or 'asynclambda' or ... . Either would need multiple use cases to justify not just using async def first.
----------
nosy: +terry.reedy
_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue33447>
_______________________________________
More information about the Python-bugs-list
mailing list