On 17/12/2022 20:45, Albert-Jan Roskam wrote:
    On Dec 15, 2022 10:21, Peter Otten <__pete...@web.de> 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

I've read somewhere that Raymond Hettinger regrets the naming and now
would favour a trailing underscore to avoid name conflicts.
--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to