[Python-Dev] Python3 compiled listcomp can't see local var - bug or feature?

Greg Ewing greg.ewing at canterbury.ac.nz
Mon Jun 11 19:08:50 EDT 2018

Skip Montanaro wrote:
> Yes, you'll have to pass in locals to exec.

Exec changed between python 2 and 3. It used to be treated
specially by the compiler so that it could see and modify
the locals where it was used. But now it's just an ordinary
function, so you can't expect it to magically know about
anything that's not passed into it.


More information about the Python-Dev mailing list