类的实例化的调用过程
创建类的两种方法
class Person(object): # 正常写法country = 'China'def __init__(self,name,age):self.name = nameself.age = agedef tell(self):print('%s 的年龄是:%s'%(self.name,self.age))
country = 'China'def __init__(self,name,age):self.name = nameself.age = agedef tell(self):print('%s 的年龄是:%s'%(self.name,self.age))Person = type('Person',(object,),{'country':country,'__init__':__init__,'tell':tell})# python 解释器 将第一种转化为第二种
