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).

Top-posted from my Windows Phone
________________________________
From: Nick Coghlan<mailto:ncogh...@gmail.com>
Sent: ‎6/‎14/‎2014 18:31
To: Steve Dower<mailto:steve.do...@microsoft.com>
Cc: Greg Ewing<mailto:greg.ew...@canterbury.ac.nz>; 
python-dev@python.org<mailto:python-dev@python.org>
Subject: Re: [Python-Dev] Criticism of execfile() removal in Python3


On 15 Jun 2014 09:37, "Steve Dower" 
<steve.do...@microsoft.com<mailto:steve.do...@microsoft.com>> wrote:
>
> I think the point is that the encoding may be embedded in the file as a 
> coding comment and there's no obvious way to deal with that.

Opening source files correctly is the intended use case for tokenize.open().

Cheers,
Nick.
_______________________________________________
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

Reply via email to