@@ -849,8 +849,9 @@ they add the ability to access fields by name instead of position index.
849849    Returns a new tuple subclass named *typename *.  The new subclass is used to
850850    create tuple-like objects that have fields accessible by attribute lookup as
851851    well as being indexable and iterable.  Instances of the subclass also have a
852-     helpful docstring (with typename and field_names) and a helpful :meth: `__repr__ `
853-     method which lists the tuple contents in a ``name=value `` format.
852+     helpful docstring (with typename and field_names) and a helpful :meth: `_repr `
853+     method, backing the default :meth: `__repr__ `, which lists the tuple contents
854+     in a ``name=value `` format.
854855
855856    The *field_names * are a sequence of strings such as ``['x', 'y'] ``.
856857    Alternatively, *field_names * can be a single string with each fieldname
@@ -967,6 +968,21 @@ field names, the method and attribute names start with an underscore.
967968        remediation is to cast the result to the desired type:
968969        ``OrderedDict(nt._asdict()) ``.
969970
971+ .. method :: somenamedtuple._repr() 
972+ 
973+     Return a representation of the named tuple contents in a ``name=value `` format.
974+     The default ``__repr__ `` implementation uses it to produce the representation.
975+ 
976+     .. doctest ::
977+ 
978+         >>> p =  Point(x = 11 , y = 22 ) 
979+         >>> p._repr() 
980+         'Point(x=11, y=22)' 
981+         >>> p 
982+         Point(x=11, y=22) 
983+ 
984+     .. versionadded :: 3.14 
985+ 
970986.. method :: somenamedtuple._replace(**kwargs) 
971987
972988    Return a new instance of the named tuple replacing specified fields with new
@@ -1064,6 +1080,9 @@ fields:
10641080.. versionchanged :: 3.5 
10651081   Property docstrings became writeable.
10661082
1083+ .. versionchanged :: 3.13 
1084+    Default :func: `_repr `
1085+ 
10671086.. seealso ::
10681087
10691088   * See :class: `typing.NamedTuple ` for a way to add type hints for named
0 commit comments