[code.view]

[top] / python / PyMOTW / threading / threading_subclass.py

     #!/usr/bin/env python
     # encoding: utf-8
     #
     # Copyright (c) 2008 Doug Hellmann All rights reserved.
     #
     """Subclassing Thread to create your own thread types.
     """
     #end_pymotw_header
     
     import threading
     import logging
     
     logging.basicConfig(level=logging.DEBUG,
                         format='(%(threadName)-10s) %(message)s',
                         )
     
     class MyThread(threading.Thread):
     
         def run(self):
             logging.debug('running')
             return
     
     for i in range(5):
         t = MyThread()
         t.start()
     

[top] / python / PyMOTW / threading / threading_subclass.py

contact | logmethods.com