namedtuple._source 不适用于 python 3.7

namedtuple._source not working in python 3.7

我试过这个代码

from collections import namedtuple
t = namedtuple('t', 'a b c')
i = t(1,2,3)
print(i._source, t._source)

但是当我 运行 它说没有属性 _source (对于 t 因此也对于 i)。从3.6开始淘汰了吗?

是的,如 here 所述,属性 _source 已从 Python 3.7 中的 namedtuples 中删除。

Changed in version 3.7: Remove the verbose parameter and the _source attribute.