why the super class can access the subclass's attribute

yousay qq263020776 at gmail.com
Thu Jan 21 05:56:07 CET 2010


I have sees aprogram like this ,i confusing why super class can access
the subclass's attribute
,this is the program,thanks in advance:
class MyThread(threading.Thread):
    def join(self):
        super(MyThread,self).join()
        return self.result

class Worker(MyThread):
    import random
    import pdb
    pdb.set_trace()
    def run(self):
        total = 0
        for i in range(random.randrange(10,100)):
            total +=i
        self.result = total





More information about the Python-list mailing list