*args question

grocery_stocker cdalten at gmail.com
Wed Mar 25 10:05:16 EDT 2009


Given the following code...

#!/usr/bin/env python

import time
import thread

def myfunction(string,sleeptime,*args):
    while 1:

        print string
        time.sleep(sleeptime) #sleep for a specified amount of time.

if __name__=="__main__":

    thread.start_new_thread(myfunction,("Thread No:1",2))

    while 1:pass

Taken from following URL....
http://linuxgazette.net/107/pai.html


How can myfunction() extract the tuple ("Thread No:1",2) from
start_new_thread() if myfunction is only being passed the single arg
("Thread No:1",2)



More information about the Python-list mailing list