[MERGE] Allow appending path segments to the :<name> style aliases.

Michael Hudson michael.hudson at canonical.com
Thu Aug 14 21:26:01 BST 2008


John Arbash Meinel wrote:
> Michael Hudson wrote:
> 
> ...
> 
>>>>> +        if '/' in url:
>>>>> +            name = url[1:url.find('/')]
>>>>> +            extra = url[url.find('/') + 1:]
>>>>> +        else:
>>>>> +            name = url[1:]
>>>>> +            extra = None
> 
> ...
> 
>>> Actually, I was talking about just the portion in the first 'if' statement:
>>>
>>> if '/' in url:
>>>   name, extra = url[1:].split('/')
>>> else:
>>>   name = url[1:]
>>>   extra = None
>>>
>>> Which is, as far as I can tell, true, and avoids doing 2 string finds
>>> and a bit of additions.
>> I don't mean to be rude, but I think you may have worried about
>> performance too much for your own good...
> 
> Perhaps. But I also think the code is *clearer* and a lot more obvious
> about getting the edge conditions correct.

That's a more reasonable objection!  I don't particularly agree, but
it's an opinion I can respect.

Cheers,
mwh



More information about the bazaar mailing list