[PATCH 1 of 2] keyword: fix: Use os.sep for Source and Header keywords

Georg Brandl g.brandl at gmx.net
Sun Jan 31 15:12:48 UTC 2010


Am 31.01.2010 14:04, schrieb Mads Kiilerich:
> David Soria Parra wrote, On 01/31/2010 01:19 PM:
>> On 2010-01-30, Kevin Grover<kevin at kevingrover.net>  wrote:
>>    
>>> @@ -115,9 +115,9 @@
>>>           'RCSfile': '{file|basename},v',
>>>           'RCSFile': '{file|basename},v', # kept for backwards compatibility
>>>                                           # with hg-keyword
>>> -        'Source': '{root}/{file},v',
>>> +        'Source': '{root}%s{file},v' % (os.sep, ),
>>>      
>> why don't you use '{root}%s{file,v' % os.sep, instead of (os.sep,) ?
>>    
> 
> FWIW I prefer the latter to avoid the (mis)feature that % can take 
> either a single value or a list of values (which itself is a value too).

s/list/tuple/.

> By specifying a singleton tuple it is unambiguous what is meant. It 
> could make a difference if os.sep happend to be a list and we expected 
> the string representation of it.
> 
> It could also make a difference when converting to python 3 - I don't know.

It can only make a difference if os.sep could be a tuple, which is not the
case, but of course it's not wrong either.

Georg

-- 
Thus spake the Lord: Thou shalt indent with four spaces. No more, no less.
Four shall be the number of spaces thou shalt indent, and the number of thy
indenting shall be four. Eight shalt thou not indent, nor either indent thou
two, excepting that thou then proceed to four. Tabs are right out.




More information about the Mercurial-devel mailing list