Thomas Dybdahl Ahle <lob...@gmail.com> added the comment:

Just wanted to add another use-case. In a project I'm working on, we are 
building a lot of graphs using code like this:

```
nodes = [
    Node('node-name1',
         children=[...],
         classifier=has_foo),
    Node('node-name2',
         children=[...],
         classifier=has_bar),
    ...
]
```
where `has_foo` and `has_bar` are async functions.
Sometimes it would be useful to combine two functions with
```
    Node('node-name',
         children=[...],
         classifier=async lambda: x: await has_bar(x) or await has_foo(x))
```
If this function was to be an `async def`, rather than `async lambda`, it would 
have to be defined far away from where it is used. This doesn't always make 
sense semantically.

I don't think this example on its own is enough to warrant new syntax in the 
language, but if somebody is collecting "multiple use cases to justify not just 
using async def first", perhaps it's worth including.

----------
nosy: +thomasahle

_______________________________________
Python tracker <rep...@bugs.python.org>
<https://bugs.python.org/issue33447>
_______________________________________
_______________________________________________
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com

Reply via email to