[issue32961] namedtuple displaying the internal code

Eric V. Smith report at bugs.python.org
Tue Feb 27 05:37:05 EST 2018


Eric V. Smith <eric at trueblade.com> 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 = 'c'

'b' is a True value, so that's why it's showing the output.

You want to be using: 
sample = namedtuple('Name', ['a', 'b', 'c'])

----------
nosy: +eric.smith
resolution:  -> not a bug
stage:  -> resolved
status: open -> closed

_______________________________________
Python tracker <report at bugs.python.org>
<https://bugs.python.org/issue32961>
_______________________________________


More information about the Python-bugs-list mailing list