Hacker News new | ask | show | jobs
by shakna 2008 days ago
> This is because since it's on a single line, it is all buffered (packed) before we get it.

Usually. Depending on the environment. It's probably worth pointing out here that Python isn't controlling that buffering - print could have its own buffer, and it could be read that way, but it doesn't.

And buffering-to-newline is a common behaviour, but not necessarily a guaranteed behaviour. You may still wish to flush after a newline, depending on the platform.

Unless you're in REPL, in which case Python often tells the environment how it would like it to buffer, as part of the readline implementation.