[Python-Dev] Re: Missing arguments in RE functions

Erik Heneryd erik at heneryd.com
Sat Sep 11 18:34:40 CEST 2004


Nicolas Fleury wrote:
> Guido van Rossum wrote:
> 
>> And how is it more consistent that in one form you have to write
>>
>> re.compile(r"[a-z]+", re.I).search(line)
>>
>> while in the other form you have to write
>>
>> re.search(r"[a-z]+", line, re.I)
>>
>> ???
>>
>> This parameter ordering issue alone makes me cringe at adding the
>> flags to the functions.
> 
> 
> I agree.  In fact, probably the line parameter should have been the 
> first parameter for all functions, but anyway it's too late for that. 
> The few times I have not used pattern objects in quick scripts, I always 
> put the line at first at the wrong place instinctively, probably for the 
> reason you mention (and I'm not pretending my instinct is universal). In 
> that context, keeping the API is even more reasonable.

Well, considering that mandatory parameters must come before optional 
ones, theres really not much to do.  At least the mandatory function 
parameters are in the "right" order.


Erik




More information about the Python-Dev mailing list