On 28/04/2014 12:49, Steven D'Aprano wrote:
......

Well, I don't know about "almost any", but at least some broken regexes
will explicitly fail:



py> import re
........
sre_constants.error: nothing to repeat

(For brevity I have abbreviated the traceback.)

so there is intent to catch some specification errors.

I've abandoned this translation anyhow as all that was intended was to split the string into non-overlapping strings of size at most k. I find this works faster than the regexp even if the regexp is pre-compiled.

[p[i:i+k] for i in xrange(0,len(p),k)]
--
Robin Becker

--
https://mail.python.org/mailman/listinfo/python-list

Reply via email to