title: Piping two never ending python process
body: <p>So I have 2 python programs
  <code>p1.py</code></p>
  <pre class="lang-py prettyprint-override"><code>import datetime
  import time
  
  #while(1): ---&gt; stuck
  for i in range(5):
      print(datetime.datetime.now())
      time.sleep(2)
  </code></pre>
  <p>and
  <code>p2.py</code></p>
  <pre class="lang-py prettyprint-override"><code>import time
  while(1):
      print('received: ', input())
  </code></pre>
  <p>Now I am <code>piping</code> the output of <code>p1.py</code> to <code>p2.py</code> with</p>
  <pre class="lang-py prettyprint-override"><code>python p1.py | python p2.py
  </code></pre>
  <p>This bash command should start 2 independent processes in parallel, but it seems it hangs until <code>p1.py</code> finishes, then the <code>p2.py</code> stats getting the input. And if I change the <code>for in</code> with infinite <code>while(1)</code> the program just freezes.</p>
  <p>My expectation was that process <code>p1</code> will emit every 2 seconds and process <code>p2</code> will consume it and I will get output in terminal emulator at every 2 second, where is my understaing wrong regarding pipe?</p>