On Fri, Mar 19, 2010 at 6:42 PM, Kevin Adams <incensedp...@gmail.com> wrote: > Greetings! > > Please forgive me if im posting this to the wrong group. > > I'm new to Python, learning Python3 from the O'rielly "Learning > Python" book. Reading > about operator overloading, specifically __getitem__. I put together > a small bit of code to > do some experimenting and threw in a timer so i can see it do its > thing. For some reason > the time.sleep(x) function doesnt work when my print function includes > "end=''". > > Thanks in advance for any help. > > > ---code--- > > class TestClass(): > def __init__(self): > self.data = "I was far from home and the spell of the eastern > sea was upon me." > > def __getitem__(self,i): > return self.data[i] > > > import time > > if __name__ == "__main__": > > me = TestClass() > for x in me: > print(x,end='') #if i remove the 'end=''' it performs as i'd > expect > time.sleep(int(2)) > > -- > http://mail.python.org/mailman/listinfo/python-list >
I'm guessing wildly here but I think you have to flush the output. Can't remember how right now but it won't take much googling for it. -- http://mail.python.org/mailman/listinfo/python-list