ChatCrawlersearch across public Telegram Open the app
P

Python

сообщение · 2025-07-29 08:16 UTC
E
Hi! I want to share my new library: transfunctions. It solves the problem of code duplication that arose as a result of the split between the sync and async halves of the Python ecosystem. The most interesting part of the library is the superfunctions. They allow you to create functions that are both regular and asynchronous: from asyncio import run from transfunctions import (     superfunction,     sync_context,     async_context,     generator_context,     await_it, ) @superfunction def my_superfunction():     print('so, ', end='')     with sync_context:         print("it's just usual function!")     with async_context:         print("it's an async function!") ~my_superfunction() #> so, it's just usual function! run(my_superfunction()) #> so, it's an async function! So, we get functions where the client can decide for himself whether to use them as synchronous or asynchronous. Under the hood, AST-level code generation is used here, which compiles synchronous and asynchronous versions of the original function on the fly.

Вся лента · оригинал в Telegram

Open in Telegram Каталог площадок Искать в ChatCrawler

A snapshot of an open public feed from the search index ChatCrawler — “Google for public Telegram”; refreshed as the venue is crawled. Times are UTC.

Public content only, official Telegram API. About · FAQ · What we do not do · Remove a page · Catalog