为什么 Python 使用 None 类型提示而不是 NoneType?

Why does Python use the None type hint instead of NoneType?

对于 Python 的 None 对象,使用类型提示 None 而不是其实际类型 NoneType。来自 docs:

Note that None as a type hint is a special case and is replaced by type(None).

我觉得这很混乱,没有给出进一步的解释。

有人知道这背后的原因吗?

这只是一种设计选择。这背后没有特别的原因。

def fn(x: None) -> Nonedef fn(x: NoneType) -> NoneType更简洁(恕我直言也更清楚)。

它也与其他类型提示一致:ListDict 等,它们都是首字母大写的单个单词(与关联的内置函数相同)。