namedtuple._replace() doesn’t work as described in the documentation
Yes it does, it works exactly as documented. ._replace returns a new namedtuple, it does not modify the original, so you need to write this: p = p._replace(x=33) See here: somenamedtuple._replace(kwargs) for more information.