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: |

Over 33,000 people sent out over 1,000 doxxing messages in the group. Although the administrators tried to delete all of the messages, the posting speed was far too much for them to keep up. “[The defendant] could not shift his criminal liability,” Hui said. To upload a logo, click the Menu icon and select “Manage Channel.” In a new window, hit the Camera icon. So far, more than a dozen different members have contributed to the group, posting voice notes of themselves screaming, yelling, groaning, and wailing in various pitches and rhythms. As the broader market downturn continues, yelling online has become the crypto trader’s latest coping mechanism after the rise of Goblintown Ethereum NFTs at the end of May and beginning of June, where holders made incoherent groaning sounds and role-played as urine-loving goblin creatures in late-night Twitter Spaces.
from us


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