Message337980
| Author | Martin Hosken |
|---|---|
| Recipients | Martin Hosken |
| Date | 2019-03-15.10:44:12 |
| SpamBayes Score | -1.0 |
| Marked as misclassified | Yes |
| Message-id | <1552646652.54.0.949988321046.issue36300@roundup.psfhosted.org> |
| In-reply-to |
| Content | |
|---|---|
The following code fails:
>>> lcls = {'w': 100}
>>> eval('[w for x in ("hello", "world")]', None, lcls)
Traceback (most recent call last):
File "<stdin>", line 1, in <module>
File "<string>", line 1, in <module>
File "<string>", line 1, in <listcomp>
NameError: name 'w' is not defined
>>> eval('[w, w, w]', None, lcls)
[100, 100, 100]
whereas in python2 it succeeds
>>> lcls = {'w': 100}
>>> eval('[w for x in ("hello", "world")]', None, lcls)
[100, 100] |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2019-03-15 10:44:12 | Martin Hosken | set | recipients: + Martin Hosken |
| 2019-03-15 10:44:12 | Martin Hosken | set | messageid: <1552646652.54.0.949988321046.issue36300@roundup.psfhosted.org> |
| 2019-03-15 10:44:12 | Martin Hosken | link | issue36300 messages |
| 2019-03-15 10:44:12 | Martin Hosken | create | |