On 15 June 2014 13:15, Steve Dower <steve.do...@microsoft.com> wrote: > So is exec(tokenize.open(file).read()) the actual replacement for > execfile()? Not too bad, but still not obvious (or widely promoted - I'd > never heard of it).
Yes, that's pretty close. It's still a dubious idea due to the implicit modification of the local namespace (and the resulting differences in behaviour at function level due to the fact that writing to locals() doesn't actually update the local namespace). That said, the "implicit changes to the local namespace are a bad idea" concern applies to exec() in general, so it was the "it's just a shorthand for a particular use of exec" aspect that tipped in the balance in the demise of execfile (this is also implied by the phrasing of the relevant bullet point in PEP 3100). Cheers, Nick. -- Nick Coghlan | ncogh...@gmail.com | Brisbane, Australia _______________________________________________ Python-Dev mailing list Python-Dev@python.org https://mail.python.org/mailman/listinfo/python-dev Unsubscribe: https://mail.python.org/mailman/options/python-dev/archive%40mail-archive.com