1 SUSPECT #1
import asyncio
async def gather_all():
return await asyncio.gather(
asyncio.sleep(0.1, result="a"),
asyncio.sleep(0.1, result="b"),
)
print(asyncio.run(gather_all())) # (no error)
['a', 'b'] 2 SUSPECT #2
import asyncio
async def fetch():
return 42
def caller():
result = await fetch()
return result
print(caller()) Traceback (most recent call last):
File "lineup.py", line 9, in <module>
print(caller())
~~~~~~^^
File "lineup.py", line 7, in caller
result = await fetch()
RuntimeError: cannot use 'await' in a non-async function 3 SUSPECT #3
from functools import partial
def power(base, exp):
return base ** exp
square = partial(power, exp=2)
print(square(5), square(10)) # (no error)
25 100 4 SUSPECT #4
import struct
packed = struct.pack(">HH", 100, 200)
print(packed.hex()) # (no error β big-endian 2 unsigned shorts)
006400c8 5 SUSPECT #5
from enum import IntEnum
class Priority(IntEnum):
LOW = 1
HIGH = 10
print(Priority.HIGH * 2, Priority.HIGH > Priority.LOW) # (no error β IntEnum members ARE ints + can be compared and arithmetic'd)
20 True