Python 3: exec arg 1

Terry Reedy tjreedy at udel.edu
Sun Jan 18 04:08:16 CET 2009


Alan G Isaac wrote:
>> Alan G Isaac wrote:
>>> Is it intentional that ``exec`` cannot handle a TextIOWrapper?
> 
>>> Bottom line: has ``execfile(filename)`` really become
>>> ``exec(open(filename).read())``? Is this a good thing?
> 
> 
> On 1/17/2009 4:20 PM Terry Reedy apparently wrote:
>> Yes. Yes.
> 
> 
> OK.  Why?

This: execfile(filename)
is a trivial (9 keystroke) abbreviation of
this: exec(open(filename).read())
which is similar in effect to
this: from filename import *
so it is really not needed.




More information about the Python-list mailing list