I’ve tried with this code
JavaScript
x
5
1
from collections import namedtuple
2
t = namedtuple('t', 'a b c')
3
i = t(1,2,3)
4
print(i._source, t._source)
5
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.