From: Raymond Hettinger Date: Wed, 14 Nov 2007 22:56:16 +0000 (+0000) Subject: Make __fields__ read-only. Suggested by Issac Morland X-Git-Tag: v2.6a1~1057 X-Git-Url: https://granicus.if.org/sourcecode?a=commitdiff_plain;h=78f27e001b5099fee2139afedb2f0992c7022be8;p=python Make __fields__ read-only. Suggested by Issac Morland --- diff --git a/Lib/collections.py b/Lib/collections.py index e0782d03ef..40f5187bce 100644 --- a/Lib/collections.py +++ b/Lib/collections.py @@ -54,7 +54,7 @@ def namedtuple(typename, field_names, verbose=False): template = '''class %(typename)s(tuple): '%(typename)s(%(argtxt)s)' __slots__ = () - __fields__ = %(field_names)r + __fields__ = property(lambda self: %(field_names)r) def __new__(cls, %(argtxt)s): return tuple.__new__(cls, (%(argtxt)s)) def __repr__(self):