title: When to use close() and __del__() in Pyserial?
body: <p>According to <a href="https://pythonhosted.org/pyserial/pyserial_api.html?highlight=setdtr#serial.Serial.read" rel="nofollow noreferrer">documentation</a>, class <code>serial.Serial()</code> has the following methods. </p>
  
  <pre><code>close()
  Close port immediately.
  
  __del__()
  Destructor, close port when serial port instance is freed.
  </code></pre>
  
  <p>I would like to know when I should use <code>close()</code> and <code>__del__()</code>? Example, I have a GUI that created an instance of <code>serial.Serial()</code> with an assigned port. According to documentation, the assigned port will be opened when the instance of <code>serial.Serial()</code>. Now when I terminate my GUI, am I correct to say that <code>__del__()</code> (and not <code>close()</code>) is the most appropriate method to use to close the serial port?</p>