Отдельно разберём 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
💵23,500 in prize pools from Bidask, TeFi Alliance, Aura, and Inflake
Still time to jump in — here’s what’s active right now:
🪙Torch Finance × TeFi Alliance
Prize pool: $20,000
Complete simple on-chain tasks; just under a month left.
Details in our post
💲Bidask Stable Pool (tgUSD / USDT)
Extra pool: $2,000
Swap or add liquidity — current APY ≈ 15 %.
🏆Joint contest: AURA × Inflake × Bidask
$1,500 prize pool
$50 bonus in Token Rain for users who join via our link — —awarded according to the leaderboard of collected coins.
Results in about a week
Prizes for the top three:
🥇 — 5 games
🥈 — 3 games
🥉 — 2 games
🤔How Aura works
➡️ Each user gets free “games”; every game earns about $1.5 in tokens you can withdraw immediately.
➡️ After a quick tutorial you unlock three more games. To cash out, you’ll need an NFT pass, which adds extra games and an expected return of roughly 10%.
Bidask app | Aura bot
#Web3#CryptoNews#PrizePool
🚀 Binance to Launch Treehouse (TREE) Trading Tournament with 3.5 Million TREE Prize Pool
According to the announcement from Binance, the platform is set to host a Treehouse (TREE) Trading Tournament, offering eligible participants a chance to share a prize pool of 3,500,000 TREE in token vouchers. The promotion period is scheduled from 2026-04-09 10:00 (UTC) to 2026-04-19 10:00 (UTC). Eligibility for participation extends to all verified new, regular users, and Binance VIP users, while liquidity providers in the Binance Spot Liquidity Provider Program and Binance Brokers are excluded.
Eligible trading pairs for the tournament include TREE/USDT and TREE/USDC. Participants must trade a cumulative amount of at least 500 USD equivalent in these pairs on Binance Spot during the promotion period to qualify for rewards. The reward structure is based on rankings determined by cumulative trading volume, with the top five participants receiving substantial TREE token vouchers. Specifically, the first-place winner will receive 175,000 TREE, while subsequent places will receive decreasing amounts down to the fifth place, which will earn 35,000 TREE. Participants ranked sixth to twentieth will share 315,000 TREE equally, and those ranked twenty-first to fiftieth will split 280,000 TREE. Further, participants ranked fifty-first to two hundredth will share 490,000 TREE, and those ranked two hundred first to one thousandth will also split 490,000 TREE. Remaining eligible participants will share 1,400,000 TREE, capped at 300 TREE per user.
Token vouchers will be distributed by 2026-05-03 and must be redeemed within 21 days. The leaderboard, updated daily, will display only users who meet the minimum trading volume threshold. Binance reserves the right to disqualify participants for dishonest behavior and may amend terms without prior notice. The tournament's commencement is contingent upon the successful listing of the TREE token on Binance Spot.
#Binance#Treehouse#TREE#TradingTournament#PrizePool#TokenVouchers#LiquidityProviders#SpotTrading#USDT#USDC#VIPUsers#BinanceVIP#CumulativeTradingVolume#Leaderboard#CryptoPromotion#TradingRewards#TREEtoken