where are the "class variables"?

Tom Hanks thanks200 at hotmail.com
Tue Sep 30 21:16:29 EDT 2003


Access class members... as members of the class! :)

class Server(threading.Thread):
    running = 0

    def run(self):
        Server.running = 1                # note added "Server."
        while Server.running:             # ditto, added "Server."
            print "do something here..."  

    def exit(self):
        Server.running = 0                # ditto, added "Server."

TTFN,
Tom.




More information about the Python-list mailing list