Why does this not work?
f = lambda A, B:[eval(i) for i in 'AB']
In Python 3, the following error is returned:
Traceback (most recent call last):
File "python", line 1, in <module>
File "python", line 1, in <lambda>
File "python", line 1, in <listcomp>
File "<string>", line 1, in <module>
NameError: name 'A' is not defined
when trying f(1, 2)
. However, surely the function should return [1, 2]
...