On 16 Oct 2016, at 15:30, Pierre-Yves David <pierre-yves.da...@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`. See the https://docs.python.org/3/library/collections.html#collections.namedtuple documentation: > 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. and https://docs.python.org/3/library/collections.html#collections.somenamedtuple._replace for the specific method: > Return a new instance of the named tuple replacing specified fields with new > values -- Martijn
Description: Message signed with OpenPGP using GPGMail
_______________________________________________ Mercurial-devel mailing list Mercurialfirstname.lastname@example.org https://www.mercurial-scm.org/mailman/listinfo/mercurial-devel