On Wed, Sep 30, 2020 at 7:30 PM Greg Ewing <greg.ewing@canterbury.ac.nz> wrote:
On 1/10/20 4:25 pm, David Mertz wrote:
> In all the years I've used and taught namedtuples, I think I've never
> used the ._replace() method.  The leading underscore is a hint that the
> method is "private"

Usually that would be true, but namedtuple is a special case. The
docs make it clear that the underscore is there to prevent it from
clashing with a potential field name, not to suggest privateness.

OK, that's a good point.  I kinda hadn't thought about that fact.  But nonetheless, I haven't been shy to use ._asdict(), so I wasn't avoiding ._replace() out of concerns for a "private" declaration.  It's just not a thing I've needed.  Which makes me feel like having a way to spell it that is a few characters shorter is not an important life concern for me. :-)
 

--
The dead increasingly dominate and strangle both the living and the
not-yet born.  Vampiric capital and undead corporate persons abuse
the lives and control the thoughts of homo faber. Ideas, once born,
become abortifacients against new conceptions.