python的设计模式

清华大佬耗费三个月吐血整理的几百G的资源,免费分享!....>>>

# encoding=utf-8  
def printInfo(info):  
    print unicode(info, 'utf-8').encode('gbk')  
  
class Person():  
    name = ""  
      
    def __init__(self, name):  
        self.name = name;  
        return;  
      
    def Show(self):  
        printInfo("zhuangbanhao%s" % self.name)  
class Finery(Person):  
    component = None  
      
    def __init__(self):  
        return;  
      
    def Decorate(self, component):  
        self.component = component  
          
    def Show(self):  
        if(None != self.component):  
            self.component.Show()  
              
class BigTrouser(Finery):  
    def Show(self):  
        printInfo("ku_zi")    
        self.component.Show()        

class TShirts(Finery):  
    def Show(self):  
        printInfo("t_shirt")  
        self.component.Show()  
  
def clientUI():  
    xc = Person("xiaocai")  
    bT = BigTrouser()  
    TS = TShirts()  
    bT.Decorate(xc)  
    TS.Decorate(bT)  
    TS.Show()  
    return  
  
if __name__ == '__main__':  
    clientUI();