On Dec 15, 2022 10:21, Peter Otten <[email protected]> wrote:

     >>> from collections import namedtuple
     >>> Row = namedtuple("Row", "foo bar baz")
     >>> row = Row(1, 2, 3)
     >>> row._replace(bar=42)
     Row(foo=1, bar=42, baz=3)

   ====
   Ahh, I always thought these are undocumented methods, but: "In addition to
   the methods inherited from tuples, named tuples support three additional
   methods and two attributes. To prevent conflicts with field names, the
   method and attribute names start with an underscore."
   
https://docs.python.org/3/library/collections.html#collections.somenamedtuple._make
-- 
https://mail.python.org/mailman/listinfo/python-list

Reply via email to