Take this Python 3 code snippet:
print("walrus")
timeConsumingTask()
print("giraffe")
When run, it prints walrus
and, after a delay, giraffe
(each on their own lines).
Now take this similar snippet:
print("walrus", end=' ')
timeConsumingTask()
print("giraffe", end=' ')
After a delay, it prints walrus giraffe
at the same time — although I would expect the first word to print first, and then the second, with a delay in between.
Why is this happening? And is there anyway of fixing this (besides not using end
)?
I am using Python 3.4.2.