Author PAG
Recipients PAG
Date 2010-08-04.11:48:12
SpamBayes Score 6.70686e-10
Marked as misclassified No
Message-id <>
collections.namedtuple hardcodes the class name which is reported in the new type's __repr__. This is irritating when subclassing a namedtuple:

A = collections.namedtuple('A', '')
class B(A):
print B()  # shows 'A()'

It might not be often that they're subclassed, but it can be a useful way to add extra methods, properties, and documentation. Other classes often use the current instance's class name in the repr (e.g. collections.OrderedDict). The attached patch changes namedtuple to do this, includes a testcase, and updates the documentation.
Date User Action Args
2010-08-04 11:48:15PAGsetrecipients: + PAG
2010-08-04 11:48:15PAGsetmessageid: <>
2010-08-04 11:48:13PAGlinkissue9507 messages
2010-08-04 11:48:12PAGcreate