Стандартная библиотека asyncio это стандарт (начиная с Py3.4) для работы с асинхронным кодом. Но эта библиотека достаточно низкоуровневая, со своими проблемами, устаревшими подходами.
Чтобы исправить это, были созданы разные обертки и альтернативы с реализацией популярных инструментов и паттернов асинхронного программирования. Это такие библиотеки как:
- trio: улучшает корректность выполнения, не оставляя потерянных корутин при ошибках, то есть предлагает Structured Concurrency из коробки.
- curio: упрощение синтаксиса и читаемости кода, больше похоже на работу с потоками.
- anyio: универсальная обертка над asyncio или trio плюс множество вспомогательных инструментов.
anyio используется в FastAPI как основная библиотека для работы с асинхронным кодом и вызовом синхронного кода из асинхронного.
В общем, рекомендую почитать про возможности anyio, возможно вы более не будете использовать чистый asyncio в своих проектах)
Это совсем не значит что дефолтный asyncio плох, он тоже даёт достаточный для работы функционал и продолжает развиваться. Например, в версии 3.11 появились TaskGroup, с похожим на trio функционалом. Так что он тоже актуален, просто придется больше написать кода самостоятельно.
#libs#async
Myth: The tongue is divided up into specific areas that are solely responsible for sensing certain tastes (e.g., sweet at the tip, bitter at the back)
Fact: The tongue's receptor cells that identify the molecules underlying the basic tastes (sweet, sour, salt, bitter and umami) are distributed on taste buds all over the tongue although some areas may be slightly more sensitive to certain flavors..
@googlefactss#humanbody#nowyouknow#mythbusted
[read more...]
People think hair and nails grow after death, but it’s an optical illusion: as skin dehydrates and shrinks, nails and hair look longer — No actual postmortem growth happens.
[Learn more]
@googlefactss
#Forensics#MythBusted
Myth: Glass flows over time, making old windows thicker at the bottom.
Fact: Glass is an amorphous solid, meaning its atoms are arranged randomly, not in a pattern like crystals. It stays solid at all normal temperatures and only softens above 600°C (1112°F). Old windows are thicker at the bottom because of how they were made, not because glass moves. 🔥🌡️
[Read more]
@googlefactss
#GlassFacts#Science#MythBusted#Heat
Viking helmets with horns are -mostly- a myth. Only one authentic Viking helmet exists, without horns. Horned helmets appear in art linked to berserkers—fierce warriors who likely wore them for rituals, not battle. Horns would be impractical in combat, and no historical records mention Vikings wearing them. Real Viking helmets were simple and functional. ⚔️🛡️
[More🪖]
@googlefactss
#Vikings#History#MythBusted#Berserkers#Archaeology
❄️ Hot water does NOT freeze faster than cold water.
While a rare phenomenon called the Mpemba effect suggests it can happen under specific conditions, cold water almost always freezes first.
[Source]
This post is a correction for another one we posted in the past [here]
@googlefactss#Science#Physics#WaterFreezing#MpembaEffect#MythBusted
The idea that skinny people have fast metabolisms is a myth. Metabolism depends largely on muscle mass—more muscle means higher energy use. Skinny people usually have less muscle, so their metabolism is often slower. Weight and appearance don’t reliably show metabolism speed.
[Read more]
@googlefactss
#Metabolism#MythBusted#Health#Fitness#BodyScience
Myth: opposums sleep while hanging by their tails.
Fact: Opossums do not hang upside down by their tails 🐾. Their tails are strong for gripping branches and carrying nesting materials but can’t hold their full weight for long. Young opossums might dangle briefly but don’t sleep that way. They “play possum” by pretending to be dead when scared, which helps protect them from predators.
🌙🐾🌳
[Read more]
@googlefactss#PossumFacts#AnimalBehavior#NatureFacts#MythBusted#DisneyWasWrong