On Wed, Sep 30, 2020 at 7:30 PM Greg Ewing <greg.ew...@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.
_______________________________________________
Python-ideas mailing list -- python-ideas@python.org
To unsubscribe send an email to python-ideas-le...@python.org
https://mail.python.org/mailman3/lists/python-ideas.python.org/
Message archived at 
https://mail.python.org/archives/list/python-ideas@python.org/message/MEXN7ADVEKGD55HT3WU5C3NLYP2J4JZW/
Code of Conduct: http://python.org/psf/codeofconduct/

Reply via email to