Difference between object and instance in python?

后端 未结 3 1954
一整个雨季
一整个雨季 2020-12-24 03:07

This happens in python2.7

I am working on the idea of meta class in python, almost all the tutorial refer object as instance of a class, in python. However, when pla

3条回答
  •  爱一瞬间的悲伤
    2020-12-24 03:38

    Not unlike the ambiguity between "class" and "type", "instance" is synonymous to "object". Think of it this way: objects are instances of types. So, "42 is an instance of the type int" is equivalent to "42 is an int object". I usually use "instance" and "object" interchangeably. Source for quote: https://eli.thegreenplace.net/2012/03/30/python-objects-types-classes-and-instances-a-glossary

提交回复
热议问题