2

Suppose I ssh from computer A into computer B and run a python script on B which is something like the following:

...
print "Hello World"
foo()
...

Will function foo():

  1. Be executed immediately following the print ... statement?
  2. Or will it be executed after the output of the print ... statement is visible in the terminal of computer A?

Put differently, can I speed up a python script operated remotely via ssh via removing a lot of printouts the script might have?

Perhaps this is just a fundamental flaw in my understanding of stdout/ssh/etc. but I couldn't find an answer; enlighten me!

Will Andrew
  • 693
  • 1
  • 10
  • 29
  • In the sense you are thinking of, probably not. There's probably a buffer between your Python script and the network socket connected to your machine; you write to standard output, and `sshd` transfers those bytes to the socket buffer. As long as the remote network stack can pass those bytes onto the network faster than `sshd` can fill the buffer, your program will not block. – chepner Sep 28 '18 at 15:59

0 Answers0