[Python-Dev] Criticism of execfile() removal in Python3

Steve Dower Steve.Dower at microsoft.com
Sun Jun 15 05:15:12 CEST 2014


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:ncoghlan at gmail.com>
Sent: ‎6/‎14/‎2014 18:31
To: Steve Dower<mailto:Steve.Dower at microsoft.com>
Cc: Greg Ewing<mailto:greg.ewing at canterbury.ac.nz>; python-dev at python.org<mailto:python-dev at python.org>
Subject: Re: [Python-Dev] Criticism of execfile() removal in Python3


On 15 Jun 2014 09:37, "Steve Dower" <Steve.Dower at microsoft.com<mailto:Steve.Dower at 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.
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-dev/attachments/20140615/2d15e34d/attachment-0001.html>


More information about the Python-Dev mailing list