Discuss / Python / 在测试一遍

在测试一遍

Topic source

神月宗

#1 Created at ... [Delete] [Delete and Lock User]

-- coding:utf-8 --

def iven(self,name = "iven"): print "hello,%s"%name

def jack(self,name = "jack"): print "hello,%s"%name def lusy(self,name = "lusy"): print "hello,%s"%name

class GrandPa(object): @property def gp(self): print "GrandPa!" class Father(GrandPa): @property def ft(self): print "Father!" class Son(Father): @property def son(self): print "Son!"

Family =type("Family",(Son,Father,GrandPa),dict(Chris_iven = iven,Chris_jack = jack,Chris_lusy = lusy))

me = Family() me.Chris_iven() me.Chris_jack() me.Chris_lusy()

#我发现可以obejct和dict那里可以添加多个!


  • 1

Reply