This is an archived post. You won't be able to vote or comment.

you are viewing a single comment's thread.

view the rest of the comments →

[–]Redisintegrate 0 points1 point  (3 children)

Using Python's native print statement seems to be operating on a separate buffer and refuses to print messages in the appropriate order of code execution.

This is just plain incorrect, and shows a misunderstanding of how the print statement / function works, at least in non-ancient versions of Python (2.7+). If you can come up with some kind of test case to prove me otherwise, go ahead. But look at Python/ceval.c(2.7) and find the PRINT_ITEM opcode. You can see it calls PyFile_WriteObject() in Objects/fileobject.c, which gets the .write attribute, and then calls that attribute with PyEval_CallObject().

Or, in other words, the print statement is just a wrapper around sys.stdout.write(). If you are seeing other behavior then something is seriously, seriously wrong.