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

Резултати

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

Пребарај: #splinternet

当前筛选 #splinternet清除筛选
Libreware

@libreware · Post #968 · 05.07.2021 г., 01:41

SplinterNet Android app designed to create an unblockable Twitter like network that uses no cellular or Internet communications. All messages are transmitted over Bluetooth between users, creating a true peer-to-peer messaging system. All messages are anonymous to prevent retaliation by government authorities. SplinterNet is a true peer-to-peer network in that it requires physical proximity to other people to transmit messages. In the current version this happens over a close range Bluetooth connection. To illustrate how SplinterNet works, here is an example scenario: You take a picture of a protest happening near your home. Fearing a spread of the protest the government shuts down cellular and Internet access to most citizens. You write a short message about the protest in SplinterNet and attach the picture. When you next meet with your friends, you sync SplinterNet with them. They now have your photo and will spread it to their friends. You also now have all their messages, which includes photos taken of protests happening in other parts of the country. Any person who can reach a working Internet connection can post all of these photos to any sharing service or send directly to journalists to publicize. If you fear capture, you can press a single button and all the messages in your copy of SplinterNet are deleted. Features Create a post with text and an optional single image. Mark posts as important to increase their spread within the network. These posts will be sent first during syncing and will be highlighted for the people you sync with. Delete posts to stop their spread. The contents of the network reflect what users of the network think is important and appropriate. You don't have to spread anything you don't want to. Project Status This is an experimental project still in development. All of the features listed here should work, they just haven't been tested in large networks. Please let us know how it works! https://raw.githubusercontent.com/megamattron/SplinterNet/master/other/splinterNet-infosheet.png https://github.com/megamattron/SplinterNet 📡@nogoolag📡@libreware #SplinterNet#im#messaging#p2p#bt#bluetooth