This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author terry.reedy
Recipients benrg, jackdied, r.david.murray, terry.reedy
Date 2010-06-04.22:51:29
SpamBayes Score 2.9188848e-07
Marked as misclassified No
Message-id <>
More experiments

from collections import namedtuple
foo = namedtuple('foo', '')
a = [] + foo()
print (a, type(a), len(a))
# () <class 'tuple'> 0

ie, a standard empty tuple, whereas
a = [1,1] + foo()
crashes immediately. So the behavior of list()+namedtuple depends on the length of the list.

There are also some funny interactions. Adding
    a = foo()+[]
except TypeError:
    print("correct TypeError")

after the 'foo = ' line in my original 5 line example causes the final print to crash, whereas adding the same 4 lines to the 4 line example at the beginning of this message does not obviously change anything.

David, since you omitted all details, I wonder if you tested in batch mode, as I did, and hence never tried to print the malformed object, or used different OS or hardware.
Date User Action Args
2010-06-04 22:51:31terry.reedysetrecipients: + terry.reedy, jackdied, r.david.murray, benrg
2010-06-04 22:51:31terry.reedysetmessageid: <>
2010-06-04 22:51:29terry.reedylinkissue8847 messages
2010-06-04 22:51:29terry.reedycreate