This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author thomasahle
Recipients Noah Simon, asvetlov, terry.reedy, thomasahle, yselivanov
Date 2018-05-31.09:55:25
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1527760525.87.0.682650639539.issue33447@psf.upfronthosting.co.za>
In-reply-to
Content
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.
History
Date User Action Args
2018-05-31 09:55:25thomasahlesetrecipients: + thomasahle, terry.reedy, asvetlov, yselivanov, Noah Simon
2018-05-31 09:55:25thomasahlesetmessageid: <1527760525.87.0.682650639539.issue33447@psf.upfronthosting.co.za>
2018-05-31 09:55:25thomasahlelinkissue33447 messages
2018-05-31 09:55:25thomasahlecreate