[issue16781] execfile/exec execution of class statement does not access locals()

2012-12-26 Thread Benjamin Peterson
Benjamin Peterson added the comment: Basically, it calls locals() in the function scope, which is undefined behavior. -- ___ Python tracker ___ __

[issue16781] execfile/exec execution of class statement does not access locals()

2012-12-25 Thread anatoly techtonik
anatoly techtonik added the comment: The workaround with the best case is a magical knowledge, which many don't possess and don't understand (I still don't get it). It's very tempting to ask why passing explicit namespace is the best solution, but instead I'd like to concentrate on this case w

[issue16781] execfile/exec execution of class statement does not access locals()

2012-12-25 Thread Benjamin Peterson
Benjamin Peterson added the comment: The best solution is to just always pass an explicit namespace to exec. That should be documented. -- ___ Python tracker ___ ___

[issue16781] execfile/exec execution of class statement does not access locals()

2012-12-25 Thread R. David Murray
R. David Murray added the comment: The fact that the print works should be a clue that Python is in fact finding the module and importing it. So your problem actually has to do with namespaces, which is something you have to think about when using exec or execfile. You can see this by replac