前言: Python在2.2和3.0之间,把继承了object的类叫做新式类,如果我们定义了一个类,他没有继承object,则不是新式类,则没有__class__,__bases__等属性,而用type()函数查看他的类型,不是type类,而是classobj类.在py3后,默认所有的类都继承object. 我们接下来讨论的,是新式类 1 对象就是实例,实例就是对象 2.查看对象属于哪个类,用它的__class__属性查看,或者用内置函数type() 3.查看类的父类是什么,用它的__bases…