@talks · Post #42 · 17.08.2016 г., 15:07
#JuliusCaesar
Hashtags
TGINSIGHT SIMILAR POSTS
Изворен канал @pythonotes · Post #402 · 22 дек.
Отдельно разберём TaskGroup, который пришел на замену gather в Python 3.11. Ключевые отличия ▫️create_task() возвращает объект asyncio.Task, у которого есть соответствюущие методы управления. То есть у нас больше контроля ▫️это контекстный менеджер, который гарантирует что все таски будут остановлены по выходу из контекста ▫️ошибка автоматически отменяет незавершенные задачи, ▫️except* передает нам ExceptionGroup, в котором каждую ошибку можно обработать отдельно import asyncio import random async def do_it() -> str: if random.random() < 0.1: raise ValueError('Oops') delay = random.uniform(0.5, 1.5) await asyncio.sleep(delay) return delay async def main(): try: async with asyncio.TaskGroup() as tg: for _ in range(10): tasks.append(tg.create_task(do_it())) for t in tasks: print(t.result()) except *ValueError as e: for err in e.exceptions: print(err) asyncio.run(main()) Рекомендую изучить страницу Coroutines and Tasks из документации, где представлено больше интересных примеров и механизмов - таймауты - отмена задач - создание задач из другого потока #async
Hashtags
Пребарај: #juliuscaesar
@talks · Post #42 · 17.08.2016 г., 15:07
#JuliusCaesar
Hashtags
@googlefactss · Post #40515 · 10.01.2026 г., 02:52
On January 10, 49 BC, Julius Caesar crossed the Rubicon River with his army. This was against the law and started a big war in Rome. Crossing the Rubicon meant he was ready to fight the government and take control. ⚔️🏛️ Extra fact: The phrase "crossing the Rubicon" is an idiom meaning "passing the point of no return" As you probably guessed, it is because of what Julius Caesar did. [Read more 1] [Read more 2] @googlefactss #History#JuliusCaesar#Rubicon#War
@googlefactss · Post #40810 · 16.03.2026 г., 23:01
The Battle of Munda was fought on 17 March 45 BC in southern Hispania. Julius Caesar faced the last Pompeian army led by Gnaeus Pompeius, Sextus Pompeius, and Titus Labienus. The Pompeians held high ground. After hours of heavy fighting, Caesar’s army won. Around 30,000 Pompeians were killed. The victory ended major resistance to Caesar in the Roman civil war. ⚔️🏛️ [Read more] @googlefactss #history#romanempire#ancientrome#juliuscaesar#historyfacts#war