Start is to see Liao's tutorial time some doubts
Class A (object): and Class A: What's the difference?
So the internet search, found in the python2 there is a difference, the original paste https://my.oschina.net/shyl/blog/692930:
So, I tried with python3, found that there seems to be no difference:
1 classAnimal (object):2 Print('Test')3 4A =Animal ()5 Print(A.__class__)6 Print(Type (Animal))7 Print(Type (a))8 9 classDuck ():Ten Print('Test') One Ab =Duck () - Print(b.__class__) - Print(Type (Duck)) the Print(type (b))
Result
1<class '__main__. Animal'>2<class 'type'>3<class '__main__. Animal'>4 Test5<class '__main__. Duck'>6<class 'type'>7<class '__main__. Duck'>
And when I went to check the documentation, I found that the class of the document was written like this.
1 class ClassName: 2 <statement-1>3 . 4 . 5 . 6 <statement-N>
Summary: Python2 There is a difference, Python3 no
Python Class and Class (object) Usage differences