python 3内置函数中的“类”是什么意思

python 3内置函数中的“类”是什么意思,python,python-3.x,class,Python,Python 3.x,Class,返回一个由数字或字符串x构造的整数对象,如果没有参数,则返回0。如果x是一个数字,则返回x.int。对于浮点数,它会向零截断 问题 在上面的一段中,class是什么意思?我想他们把它们都改成class而不是type 您也可以勾选它的含义与它对所有其他类的含义相同,例如: # Python 2 >>> int <type 'int'> >>> str <type 'str'> >>> bool <type 'boo

返回一个由数字或字符串x构造的整数对象,如果没有参数,则返回0。如果x是一个数字,则返回x.int。对于浮点数,它会向零截断

问题
在上面的一段中,class是什么意思?

我想他们把它们都改成class而不是type


您也可以勾选

它的含义与它对所有其他类的含义相同,例如:

# Python 2
>>> int
<type 'int'>
>>> str
<type 'str'>
>>> bool
<type 'bool'>

# Python 3
>>> int
<class 'int'>
>>> str
<class 'str'>
>>> bool
<class 'bool'>
它只是意味着它是一个类


内置类之所以特别,仅仅是因为它们是Python的内置类,因此性能更高——它们还有其他一些小毛病,但这是另一个主题。总之,您可以像对待使用类构造创建的自定义类一样对待它

“类”一词在代码中,但不在段落中。你的目标到底是什么?试图更好地理解一些东西?因为这看起来像是一个家庭作业问题?
# Python 2
>>> int
<type 'int'>
>>> str
<type 'str'>
>>> bool
<type 'bool'>

# Python 3
>>> int
<class 'int'>
>>> str
<class 'str'>
>>> bool
<class 'bool'>
class Foo: pass