Re: Python 3: exec arg 1

2009-01-22 Thread Alan G Isaac
On 1/20/2009 3:53 PM Rob Williscroft apparently wrote: http://bugs.python.org/issue1762972 (*) Useful. Thanks. Alan Isaac -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3: exec arg 1

2009-01-20 Thread Rob Williscroft
Alan G Isaac wrote in news:myhdl.805$aw2@nwrddc02.gnilink.net in comp.lang.python: > On 1/18/2009 9:36 AM Alan G Isaac apparently wrote: >> I do not much care about the disappearance of ``execfile``. >> I was asking, why is it a **good thing** that >> ``exec`` does not accept a TextIOWrapper?

Re: Python 3: exec arg 1

2009-01-20 Thread Alan G Isaac
On 1/18/2009 9:36 AM Alan G Isaac apparently wrote: I do not much care about the disappearance of ``execfile``. I was asking, why is it a **good thing** that ``exec`` does not accept a TextIOWrapper? Or is it just not implemented yet? What is the gain from this particular backwards incompatibilit

Re: Python 3: exec arg 1

2009-01-18 Thread Steven D'Aprano
On Sun, 18 Jan 2009 11:06:10 -0600, Rob Williscroft wrote: > You must have missed the subject line: "Re: Python 3: exec arg 1" Doh! -- Steven -- http://mail.python.org/mailman/listinfo/python-list

Re: Python 3: exec arg 1

2009-01-18 Thread Rob Williscroft
- open(fname) -- is a file object: > >>>> type(open('hello.py')) > > > > BTW, exec is a statement. The brackets there are totally superfluous. > You can, and should, write: > > exec open(fname) > You must have missed the subject line: "Re: Python

Re: Python 3: exec arg 1

2009-01-18 Thread Steven D'Aprano
On Sun, 18 Jan 2009 14:36:15 +, Alan G Isaac wrote: > Well, that does not really answer my question, imo. I do not much care > about the disappearance of ``execfile``. I was asking, why is it a > **good thing** that ``exec`` does not accept a TextIOWrapper? I'm not sure if this is a stupid

Re: Python 3: exec arg 1

2009-01-18 Thread Alan G Isaac
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. Alan G Isaac wrote: OK. Why? O

Re: Python 3: exec arg 1

2009-01-17 Thread Terry Reedy
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? T

Re: Python 3: exec arg 1

2009-01-17 Thread Alan G Isaac
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? Alan Isaac -- http://ma

Re: Python 3: exec arg 1

2009-01-17 Thread Terry Reedy
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`` can