คำถามติดแท็ก python-3.5

เวอร์ชันของภาษาโปรแกรม Python ที่เผยแพร่เมื่อวันที่ 13 กันยายน 2015 สำหรับปัญหาที่เฉพาะเจาะจงสำหรับ Python 3.5 ใช้แท็ก [python] และ [python-3.x] ทั่วไปมากขึ้นเท่าที่จะทำได้

4
asyncio.ensure_future กับ BaseEventLoop.create_task เทียบกับโครูทีนแบบธรรมดา?
ฉันเคยเห็นบทแนะนำ Python 3.5 พื้นฐานหลายตัวเกี่ยวกับ asyncio ที่ดำเนินการแบบเดียวกันในรสชาติต่างๆ ในรหัสนี้: import asyncio async def doit(i): print("Start %d" % i) await asyncio.sleep(3) print("End %d" % i) return i if __name__ == '__main__': loop = asyncio.get_event_loop() #futures = [asyncio.ensure_future(doit(i), loop=loop) for i in range(10)] #futures = [loop.create_task(doit(i)) for i in range(10)] futures = [doit(i) for …
โดยการใช้ไซต์ของเรา หมายความว่าคุณได้อ่านและทำความเข้าใจนโยบายคุกกี้และนโยบายความเป็นส่วนตัวของเราแล้ว
Licensed under cc by-sa 3.0 with attribution required.