资讯

Another common use of asyncio, and an under-discussed one, is waiting for some arbitrary length of time inside a coroutine. You can’t use time.sleep() for this, or you’ll block the entire program.
Python 3.9’s PEG-based parser removed these barriers, which long-term could lead to more elegant syntax — our first example of this change is the new parenthesized context managers.
Any time you want to create lots of examples of the same “thing,” or any time you want to handle complex code in a modular and easily-exported fashion, classes are a great choice.