[PATCH 2 of 2 V3] py3: use namedtuple._replace to produce new tokens

Pierre-Yves David pierre-yves.david at ens-lyon.org
Mon Oct 17 11:29:12 UTC 2016



On 10/16/2016 11:05 PM, Martijn Pieters wrote:
> On 16 Oct 2016, at 15:30, Pierre-Yves David <pierre-yves.david at ens-lyon.org> wrote:
>>
>>> py3: use namedtuple._replace to produce new tokens
>>
>> We seems to be using a private function of some stdlib type?
>> Can you elaborate on why this is a good move?
>
> It is not private. This is one of the exceptions to the Python style guide; the namedtuple methods all have a single leading underscore to avoid clashing with the field names. If they didn't, you wouldn't be able to name a field `replace`.

That was probably worth mentioning in the description. Thanks for the 
enlightening, I've accepted it as is.

Cheers

-- 
Pierre-Yves David



More information about the Mercurial-devel mailing list