1.None
- 此类型只有一种取值,是一个具有此值的单独对象,该对象通过内置名称None访问。
- 在许多情况下用来表示空值。
- 未显示指定返回值的函数将返回None。
- None的逻辑值为假。
print(type(None))
2.NotImplemented
- 此类型只有一种取值,是一个具有此值的单独对象,该对象通过内置名称NotImplemented访问。
- 进行数值比较时如果未实现指定的运算符重载方式,则应该返回此值
- NotImplemented的逻辑值为真。
print(type(NotImplemented))
3.Ellipsis
- 此类型只有一种取值,是一个具有此值的单独对象, 该对象通过字面值 … 或内置名称 Ellipsis 来访问。
- 他的逻辑值为真。
print(type(Ellipsis))
4.number.Number
5. 序列
- 此类型对象表示一个有限的集合,通过内置函数len()可以返回序列中元素的数量
- 序列支持切片操作
5.1. 不可变序列
print(type(""))
t = 1, 2
print(type(t))
print(type(b""))
5.2. 可变序列
print(type([]))
print(type(bytearray()))
6. 集合类型
print(type({1, 2}))
print(type(frozenset()))
7. 映射类型
print(type({}))
8. 可调用类型
def f(): pass
print(type(f))
class Test:
def f(self): pass
t = Test()
print(type(t.f))
print(type(Test.f))
9. 模块
import builtins
print(type(builtins))
10. 自定义类
class Test: pass
print(type(Test))
11. 类实例
class Test: pass
t = Test()
print(type(t))