[Python-Dev] partition() (was: Remove str.find in 3.0?)
Pierre Barbier de Reuille
pierre.barbier at cirad.fr
Tue Aug 30 17:50:13 CEST 2005
Shane Hathaway a écrit :
> Eric Nieuwland wrote:
>
>> Pierre Barbier de Reuille wrote:
>>
>>> Or you want to have some "partition" method which accept regular
>>> expressions:
>>>
>>> head, sep, tail = some_str.partition(re.compile(sep+'.'*offset))
>>
>>
>>
>> Neat!
>> +1 on regexps as an argument to partition().
>
>
> Are you sure? I would instead expect to find a .partition method on a
> regexp object:
>
> head, sep, tail = re.compile(sep+'.'*offset).partition(some_str)
Well, to be consistent with current re module, it would be better to
follow Antoine's suggestion :
head, sep, tail = re.partition(re.compile(sep+'.'*offset), some_str)
Pierre
>
> Shane
>
--
Pierre Barbier de Reuille
INRA - UMR Cirad/Inra/Cnrs/Univ.MontpellierII AMAP
Botanique et Bio-informatique de l'Architecture des Plantes
TA40/PSII, Boulevard de la Lironde
34398 MONTPELLIER CEDEX 5, France
tel : (33) 4 67 61 65 77 fax : (33) 4 67 61 56 68
More information about the Python-Dev
mailing list