title: Initializing a class using threading (Python)
body: <p>So I have this code</p>
  
  <pre><code>import socket
  def main():
      #does a bunch of argument parsing
  while True:
       newsock, fromaddr = s.accept()
       ssl_sock = context.wrap_socket(newsock, server_side=True)
       threading.Thread(target=tls_listener, args=(ssl_sock,)).start()
  
  def tls_listener(ssl_sock):
       #the thing I want to turn into a class
       #calls other functions, does some reporting 
  
  
  
  if __name__ == "__main__":
       main()
  </code></pre>
  
  <p>I want to make the tls_listener a class (it's grown quite a bit, and I've realized I should abstract it (and use <code>self</code> as opposed to passing variables)), but am not sure how to start up instances of a class using threading, as it needs to be passed a function. Should I do something like </p>
  
  <pre><code>class TlsListener(threading):
      #overload run()
  </code></pre>
  
  <p>or would it be possible to have the thread create new instances of a TlsListener class?</p>