PYTHON_JOB_INTERVIEW Telegram 1181
🧠 Почему asyncio вызывает боль? Потому что даже простая ошибка может сломать всю цепочку задач.

🐍 tinyio — это минималистичный event loop для Python (всего ~200 строк), который работает через yield, а не await, и делает асинхронность прозрачной.

Что умеет:
yield вместо await: проще отлаживать и понимать
• Параллельный запуск: yield [task1(), task2()]
• Фоновые задачи: yield {task1(), task2()}
• Прерывание всех задач при одной ошибке
• Встроенные Lock, Semaphore, Event, timeout

Пример:

def slow_add(x):
yield tinyio.sleep(1)
return x + 1

def main():
a, b = yield [slow_add(1), slow_add(2)]
return a + b

Loop().run(main()) # → 5


Когда нужно просто и понятно — tinyio делает то, что должен. Никакой магии.

🔗 https://github.com/patrick-kidger/tinyio

@python_job_interview
👎104👍3🔥1



tgoop.com/python_job_interview/1181
Create:
Last Update:

🧠 Почему asyncio вызывает боль? Потому что даже простая ошибка может сломать всю цепочку задач.

🐍 tinyio — это минималистичный event loop для Python (всего ~200 строк), который работает через yield, а не await, и делает асинхронность прозрачной.

Что умеет:
yield вместо await: проще отлаживать и понимать
• Параллельный запуск: yield [task1(), task2()]
• Фоновые задачи: yield {task1(), task2()}
• Прерывание всех задач при одной ошибке
• Встроенные Lock, Semaphore, Event, timeout

Пример:


def slow_add(x):
yield tinyio.sleep(1)
return x + 1

def main():
a, b = yield [slow_add(1), slow_add(2)]
return a + b

Loop().run(main()) # → 5


Когда нужно просто и понятно — tinyio делает то, что должен. Никакой магии.

🔗 https://github.com/patrick-kidger/tinyio

@python_job_interview

BY Python вопросы с собеседований




Share with your friend now:
tgoop.com/python_job_interview/1181

View MORE
Open in Telegram


Telegram News

Date: |

End-to-end encryption is an important feature in messaging, as it's the first step in protecting users from surveillance. On Tuesday, some local media outlets included Sing Tao Daily cited sources as saying the Hong Kong government was considering restricting access to Telegram. Privacy Commissioner for Personal Data Ada Chung told to the Legislative Council on Monday that government officials, police and lawmakers remain the targets of “doxxing” despite a privacy law amendment last year that criminalised the malicious disclosure of personal information. Add up to 50 administrators Don’t publish new content at nighttime. Since not all users disable notifications for the night, you risk inadvertently disturbing them. According to media reports, the privacy watchdog was considering “blacklisting” some online platforms that have repeatedly posted doxxing information, with sources saying most messages were shared on Telegram.
from us


Telegram Python вопросы с собеседований
FROM American