Message149096
| Author | amaury.forgeotdarc |
|---|---|
| Recipients | amaury.forgeotdarc, sdeibel |
| Date | 2011-12-09.14:10:57 |
| SpamBayes Score | 0.0028098032 |
| Marked as misclassified | No |
| Message-id | <1323439861.21.0.160594304585.issue13557@psf.upfronthosting.co.za> |
| In-reply-to |
| Content | |
|---|---|
This is expected and documented: http://docs.python.org/py3k/reference/executionmodel.html#interaction-with-dynamic-features "Free variables are not resolved in the nearest enclosing namespace, but in the global namespace.", a free variable being a variable "used in a code block but not defined there". And yes, a list comprehension defines a code block. Try using exec(code, locals()). It's a good habit anyway to always pass a namespace to exec(). |
|
| History | |||
|---|---|---|---|
| Date | User | Action | Args |
| 2011-12-09 14:11:01 | amaury.forgeotdarc | set | recipients: + amaury.forgeotdarc, sdeibel |
| 2011-12-09 14:11:01 | amaury.forgeotdarc | set | messageid: <1323439861.21.0.160594304585.issue13557@psf.upfronthosting.co.za> |
| 2011-12-09 14:10:57 | amaury.forgeotdarc | link | issue13557 messages |
| 2011-12-09 14:10:57 | amaury.forgeotdarc | create | |