fastapi / asyncer

Asyncer, async and await, focused on developer experience.
https://asyncer.tiangolo.com/
MIT License
1.63k stars 57 forks source link

Discussion on function naming #25

Closed wu-clan closed 2 years ago

wu-clan commented 2 years ago

First Check

Commit to Help

Example Code

import anyio
import asyncer

def sync_work(name: str):
    time.sleep(1)
    return f"Hello, {name}"

async def do_async_work(name: str):
    message = asyncer.run_sync(sync_work)(name=name)
    return message

async def main():
    message = await do_async_work(name="World")
    print(message)

asyncer.run(main)

Description

It's strange to name the three main functions, Why not use regular name?

The first two unified can be understood, but runnify is always weird.

Why not

Operating System

Windows

Operating System Details

No response

asyncer Version

0.0.1

Python Version

3.X

Additional Context

No response

bazylhorsey commented 1 year ago

more on this, I don't really understand in the docs the difference in use between runnify and syncify. At first glance it makes sense, but then when you unravel it in your head runnify is just another way of handling async in a sync context. More info on how they're distinguished would be good.