python

    技术2022-07-11  94

    ID = python_ask_01

    文章目录

    QuestionAnswerReference

    Question

    How to understand everything in Python is object?

    Answer

    Class is abstracted object, Instance is specific object, they are both object. Even number is also an object, it is instance of class int? The answer is YES

    type(1) <class 'int'> #这里的class 理解为类型的意思,int表示整数类型 #下面看看浮点数 >>> 6.6 6.6 >>> type(6.6) <class 'float'> #float 表示浮点类型

    在python中什么不是对象?[1] 字符串是类str的对象 数字是类int的对象 元组是类tuple的对象 列表是类list的对象 字典是类dict的对象 函数是类function的对象 类是type的对象

    Conclusion: Class is abstracted object, Instance is specific object, they are both object.

    Reference

    [1] python中的一切皆对象 [2] Python的基本数据类型(Number)

    Processed: 0.012, SQL: 9