mirror of
https://github.com/python/cpython.git
synced 2025-08-03 00:23:06 +00:00
Make __fields__ read-only. Suggested by Issac Morland
This commit is contained in:
parent
b5b6f3c46e
commit
78f27e001b
1 changed files with 1 additions and 1 deletions
|
@ -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):
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue