Re: sys.stdout and Python3

2013-11-24 Thread Chris Angelico
On Mon, Nov 25, 2013 at 1:31 AM, Steven D'Aprano wrote: > I don't think the REPL handles return values inside loops any different > from how it handles them outside loops. The difference is that file.write > methods used to return None in Python 2, in Python 3 they return the > number of bytes wri

Re: sys.stdout and Python3

2013-11-24 Thread Steven D'Aprano
On Sun, 24 Nov 2013 01:16:18 +1100, Chris Angelico wrote: > On Sun, Nov 24, 2013 at 12:26 AM, Frank Millman > wrote: >> for i in range(10): >> sys.stdout.write('.') >> sys.stdout.flush() >> time.sleep(1) >> sys.stdout.write('\n') >> >> I tried it under Python3, and found that it differs in

Re: sys.stdout and Python3

2013-11-23 Thread Chris Angelico
On Sun, Nov 24, 2013 at 12:26 AM, Frank Millman wrote: > for i in range(10): > sys.stdout.write('.') > sys.stdout.flush() > time.sleep(1) > sys.stdout.write('\n') > > I tried it under Python3, and found that it differs in two ways - > > 1. Each 'write' is terminated by a newline > 2. Each 'w

sys.stdout and Python3

2013-11-23 Thread Frank Millman
Hi all I have a question arising from another thread, but on a different topic, hence the new thread. Under Python2, if you want to print a series of dots to the screen without a newline, you can do the following: for i in range(10): sys.stdout.write('.') sys.stdout.flush() time.sleep(1)