Skip to content
Advertisement

namedtuple._source not working in python 3.7

I’ve tried with this code

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

But when I run it it says that there is no attribute _source (for t and therefore also for i). Has it been eliminated since 3.6?

Advertisement

Answer

Yes, as stated here, the attribute _source has been removed from namedtuples in Python 3.7.

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

Advertisement