~/dev/cpython main λ cat z.py
import random
def foo():
yield random.randint(100) # oops, only passed in one argument
yield "value"
dict([foo() for _ in range(3)])
~/dev/cpython main λ python3.12 z.py
Traceback (most recent call last):
File "/Users/shantanu/dev/cpython/z.py", line 7, in <module>
dict([foo() for _ in range(3)])
TypeError: cannot convert dictionary update sequence element #0 to a sequence
Traceback (most recent call last):
File "/Users/shantanu/dev/cpython/z.py", line 7, in <module>
dict([foo() for _ in range(3)])
File "/Users/shantanu/dev/cpython/z.py", line 4, in foo
yield random.randint(100) # oops, only passed in one argument
^^^^^^^^^^^^^^^^^^^
TypeError: Random.randint() missing 1 required positional argument: 'b'
I'd expect something like what PyPy gives:
Linked PRs