//新式类
class Foo(object):
pass
>>> Foo.__base__
<type 'object'>
>>> Foo.__bases__
(<type 'object'>,)
//经典类
class Foo:
pass
>>> Foo.__bases__
()
>>> Foo.__base__
AttributeError: class Foo has no attribute '__base__'
python 3.x class 还是有俩种定义方式,不过都是新式类
//新式类
class Foo(object):
pass
>>> Foo.__base__
<type 'object'>
>>> Foo.__bases__
(<type 'object'>,)
//新式类(隐式地继承object class)(Classes without an inheritance list inherit, by default, from the base class object)
class Foo:
pass
>>> Foo.__base__
<type 'object'>
>>> Foo.__bases__
(<type 'object'>,)