Message389469
I think this is in the same class of behaviours as
```
def func(l):
def get(i):
return l[i]
print(eval("(lambda x: get(x))(0)")) # Call anonymous lambda with the constant 0 as argument
```
Calls like ``func(["spam"])`` will not "work", and ``NameError`` is raised.
In this case, inside the lambda's body the name "get" can't be resolved. For the lambda body, the name "get" is a nonlocal but there's no way to access a nonlocal in a lambda.
The comprehensions, like lambdas, are in their own nested scope. |
|
Date |
User |
Action |
Args |
2021-03-24 15:25:01 | congma | set | recipients:
+ congma, bruno.loff |
2021-03-24 15:25:01 | congma | set | messageid: <1616599501.55.0.974031275466.issue43605@roundup.psfhosted.org> |
2021-03-24 15:25:01 | congma | link | issue43605 messages |
2021-03-24 15:25:01 | congma | create | |
|