Serhiy Storchaka added the comment:
In 2.7 namedtuple() takes four arguments.
namedtuple(typename, field_names, verbose=False, rename=False)
A sequence of field names should be passed as the second argument. In you case
you pass four argumens: 'a' as field names, 'b' as the verbose flag,
Eric V. Smith added the comment:
See https://docs.python.org/2/library/collections.html#collections.namedtuple
namedtuple is called as:
collections.namedtuple(typename, field_names[, verbose=False][, rename=False])
So you are passing in
typename = 'Name'
field_names = 'a'
verbose = 'b'
rename
Terry J. Reedy added the comment:
The behavior of collections.namedtuple has nothing to do with IDLE. I verified
the behavior in 2.7. In 3.7, one must group the field names, as in a tuple,
and the corrected statement has no output.
I had nothing to do with namedtuple development. I presume
New submission from poornaprudhvi :
>>> from collections import namedtuple
>>> sample = namedtuple('Name','a','b','c')
This is returning the following code as output:
class Name(tuple):
'Name(a,)'
__slots__ = ()
_fields = ('a',)
def __new__(_cls, a,):
'Create new inst