PEP 358 and operations on bytes

Fredrik Lundh fredrik at pythonware.com
Wed Oct 4 15:26:03 EDT 2006


John Machin wrote:

> But not on other integer subtypes. If regexps should not be restricted
> to text, they should work on domains whose number of symbols is greater
> than 256, shouldn't they?

they do:

import re, array

data = [0, 1, 1, 2]

array_type = "IH"[re.sre_compile.MAXCODE == 0xffff]

a = array.array(array_type, data)

m = re.search(r"\x01+", a)

if m:
     print m.span()
     print m.group()

</F>




More information about the Python-list mailing list