execfile() and locals()

fons at kokkinizita.net fons at kokkinizita.net
Sun Aug 15 23:21:51 CEST 2010


Hello all,

The documentation on execfile() and locals() makes it clear that code
executed from execfile() can not modify local variables in the function
from wich execfile() was called. Two questions about this:

1. Is there some way to circumvent this limitation (apart from explicitly
copying variables to/from a dictionary passed as locals to execfile()) ?

2. (for experts only I guess) I'd like to understand *why* this is the case. 

TIA,

-- 
FA

There are three of them, and Alleline.




More information about the Python-list mailing list