[Pythonmac-SIG] MacPython IDE -- Is this a bug?
Bruce Robbins
brobbins333@shaw.ca
Tue, 19 Mar 2002 10:22:26 -0800
This runs as expected as a script in the PythonWin IDE, so I guess there
would be
disagreement whether it constitutes a "bug." If I were the author of the
MacPython IDE,
I think I would try to fix it.
BR
On Mon, 18 Mar 2002, Bruce Robbins wrote:
> Try running this AS A SCRIPT in the MacPython IDE v.1.0.1:
>
> list = [33, 44, 55, 66]
>
> for each in list:
> print each,
>
>
> Make sure you include the comma after the print each statement.
> Then try it without the comma.
>
> No output in the output window when run with the comma -- until
> the script is run again without the comma!
>
If you append either:
print
or
import sys; sys.stdout.flush()
after your two lines above, you'll get the output. (The first with a
trailing newline, the latter without.)
I'm guessing that sys.stdout.close() would also work, but wouldn't
be very useful to you.
That should make the reason for the behaviour obvious.
( You don't get it in the interpreter window, because the line gets
flushed when it prints out a '>>>' prompt for the next input line.)
Is it a bug?
I'ld vote no -- it matches exactly what would happen if you had a
script writing to a file, or executed a script on the unix command line
(so you wouldn't get any prompts to the terminal) except that sys.stdout
would get flushed and closed at program termination.
-- Steve Majewski