30 Aug
2005
30 Aug
'05
9:55 a.m.
Pierre Barbier de Reuille wrote:
Shane Hathaway a écrit :
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)
Actually, consistency with the current re module requires new methods to be added in *both* places. Apparently Python believes TMTOWTDI is the right practice here. ;-) See search, match, split, findall, finditer, sub, and subn: http://docs.python.org/lib/node114.html http://docs.python.org/lib/re-objects.html Shane