Skip to content

Add support for async/await in the lambda expression. #101871

Closed as not planned
Closed as not planned

Description

@muazhari

Feature or enhancement

Need support for async/await in the lambda expression.

Pitch

I found meaningful use cases for async lambda in reactive programming. Here is the example code that should be:

async def read_one_by_id(request: ReadOneByIdRequest) -> Content[Account]:
    return rx.just(request).pipe(
        ops.map(async lambda request: await account_repository.read_one_by_id(request.id)),
        ops.map(lambda entity: Content(data=entity, message="Account read one by id succeed.")),
        ops.catch(lambda exception, source: rx.just(
            Content(entity=None, message=f"Account read one by id failed: {exception}")))
    ).run()

Previous discussion

#77628

Activity

  1. added
    type-feature
    on Feb 13, 2023
  2. added
    interpreter-core
    on Feb 13, 2023
  3. kumaraditya303 commented on Feb 13, 2023

    @kumaraditya303
    Contributor

    Please discuss this first on https://discuss.python.org/c/ideas/6 and FYI this will need a PEP.

  4. moved this from Todo to Done in asyncioon Feb 13, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    interpreter-coretopic-asynciotype-feature

    Projects

    • Status
      Done

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions