[PATCH 03 of 15 v2] dirstate: create class for status lists

Mads Kiilerich mads at kiilerich.com
Fri Oct 10 12:27:29 CDT 2014


On 10/10/2014 07:21 PM, Martin von Zweigbergk wrote:
> On Mon, Oct 6, 2014 at 11:20 AM, Mads Kiilerich <mads at kiilerich.com> wrote:
>> On 10/05/2014 08:08 AM, Martin von Zweigbergk wrote:
>>> @@ -26,6 +26,49 @@
>>>        def join(self, obj, fname):
>>>            return obj._join(fname)
>>>    +class status(tuple):
>>> +    '''Named tuple with a list of files per status.
>>> +    '''
>>
>> Hmm. There are several things I would like to point out ... but they seem to
>> all be inherited from the Python namedtuple. It might make sense to stay as
>> similar as possible but slightly different.
> Several things you would like to point out in the docstring?

No - about the whole use of named tuple. As you can see, I don't know 
exactly what my opinion is and my attempts at making an opinion are 
inconsistent. But I hope it adds value to raise the questions ;-)


>> Why not use a generic named tuple implementation ... especially on Python
>> 2.6+ where it is built-in? There might be good reasons, but they should
>> documented.
> We have to support Python 2.4-2.5 too, right? Would I have to check
> the version (or existence of named_tuple)? Or back-port it? It just
> sounds like extra code for little benefit to me, so please explain to
> a poor Python newbie.

It would perhaps be nice if we automatically could start using the 
standard named tuple _when_ we drop Python 2.4-2.5. But I realize the 
2.6 named tuple not is so elegant. Having it explicit might be more 
elegant. But as mentioned on IRC, I wonder if something simpler would be 
"better".

/Mads


More information about the Mercurial-devel mailing list