title: Python PySerial read-line timeout
body: <p>I'm using pyserial to communicate with a embedded devise. </p>
  
  <pre><code>ser = serial.Serial(PORT, BAUD, timeout = TOUT)
  ser.write(CMD)
  z = ser.readline(eol='\n')
  </code></pre>
  
  <p>So we send CMD to the device and it replies with an string of varing length ending in a <code>'\n'</code></p>
  
  <p>if the devise cant replay then <code>readline()</code> times-out and <code>z=''</code></p>
  
  <p>if the devise is interrupted or crashes will it's sending the data then <code>readline()</code> times-out 
  and z will be a string without a <code>'\n'</code> at the end.</p>
  
  <p>Is there a nice way to check if <code>readline()</code> has timed-out other than checking the state of z.</p>