TGTGInsighttelegram intelligenceLIVE / telegram public index
← Python Заметки

TGINSIGHT SIMILAR POSTS

Најди сличен содржај

Изворен канал @pythonotes · Post #400 · 8 дек.

Три способа выполнить множество задач с asyncio Функция для примера: async def do_it(n): await asyncio.sleep(random.uniform(0.5, 1)) return n 1. Последовательный вызов async def main(): for i in range(100): result = await do_it(i) Такой вызов имеет смысл только тогда, когда результат одной задачи требуется для вызова следующей. Если они независимы, то это антипаттерн, так как аналогичен простому синхронному вызову по очереди. 2. Упорядоченный результат async def main(): tasks = [do_it(i) for i in range(100)] results = await asyncio.gather(*tasks) Выполняет корутины конкурентно и возвращает результат в виде списка. Полезен когда требуется получить результаты в том же порядке в котором задачи отправлены. 3. Результат по мере готовности tasks = [asyncio.create_task(do_it(i)) for i in range(100)] for cor in asyncio.as_completed(tasks): result = await cor Так же выполняет корутины конкурентно, но не гарантирует порядок. Результат возвращается по мере готовности, каждый отдельно. Полезен когда нужно обработать любой ответ как можно скорее. #async

Hashtags

Резултати

Пронајдени 8 слични објави

Пребарај: #temple

当前筛选 #temple清除筛选

Melbourne-based architects Adam Newman and Kelvin Tsang have installed a small scale of The Parthenon clad in different hues of colors and murals within the Grollo Equiset Garden at Melbourne’s National Gallery of Victoria (NGV), Australia. The installation, called Temple of Boom, emerges as "an evocative reimagination of The Parthenon", a global architectural icon and an Ancient Greek temple located on the Acropolis, Athens. Newman and Tsang draw inspiration from the colourful and artistic embellishments that once covered the original building over two- thousand years ago. Based on these historical references, dynamic and eye-catching floral motifs and optical illusions, designed by contemporary artists Drez, Manda Lane and David Lee Pereira wrap the installation. Images 1-2-3-4 📸 seanfennessy Image 5 📸 NGV #design#temple#parthenon#installation#intervention#arch_shovel