Simon Willison on Nostr: Python asyncio question: I want to build a library that offers the same features in ...
Python asyncio question: I want to build a library that offers the same features in both sync and async formats
Are there any drawbacks to building it async, then providing a sync function which actually just calls asyncio.run(async_function(*args, **kwargs)) ?
Published at
2024-03-31 16:36:33Event JSON
{
"id": "1a720c53a275f88321cb88b72532b617c8333c948ebf59a3acde2bd78bbc3b4e",
"pubkey": "8b0be93ed69c30e9a68159fd384fd8308ce4bbf16c39e840e0803dcb6c08720e",
"created_at": 1711902993,
"kind": 1,
"tags": [
[
"proxy",
"https://fedi.simonwillison.net/users/simon/statuses/112191274596167970",
"activitypub"
]
],
"content": "Python asyncio question: I want to build a library that offers the same features in both sync and async formats\n\nAre there any drawbacks to building it async, then providing a sync function which actually just calls asyncio.run(async_function(*args, **kwargs)) ?",
"sig": "5c73b9ce6cb499e5d7e23842fd882ebc54c927912b871ea395ca265f5993db8b4c7198d98ac9f0d38bc8292aeb6e4e95828f8e4aa58c8bac40718e160f12b68a"
}