On Thu, 02 Jul 2009 03:49:57 +0000, kj wrote:

> In <xns9c3bca27abc36duncanbo...@127.0.0.1> Duncan Booth
> <duncan.bo...@invalid.invalid> writes:
>>So, for example:
> 
>>>>> re.compile("c").match("abcdef", 2)
>><_sre.SRE_Match object at 0x0000000002C09B90>
>>>>> re.compile("^c").search("abcdef", 2)
>>>>>
>>>>>
> I find this unconvincing; with re.search alone one could simply do:
> 
>>>> re.compile("^c").search("abcdef"[2:])
> <_sre.SRE_Match object at 0x75918>
> 
> No need for re.match(), at least as far as your example shows.

Your source string "abcdef" is tiny. Consider the case where the source 
string is 4GB of data. You want to duplicate the whole lot, minus two 
characters. Not so easy now.


> Maybe there are times when re.match() is more "convenient" in some way,
> but it is awfully Perlish to "multiply language elements" for the sake
> of this trifling convenience.

No, it's absolutely Pythonic. 


>>> import this
...
Although practicality beats purity.



-- 
Steven
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to