Alan G Isaac wrote:
In Python 3, you can no longer ``exec(open(filename))``.I guess the reason is that in 3.0 ``open`` returns a stream, instead of open file, and exec wants "a string, bytes, or code object" and not a "TextIOWrapper". So it returns an error. 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?
Yes. Yes. -- http://mail.python.org/mailman/listinfo/python-list