> what makes you think a match object is immutable? Because you cannot modify their state. > import array, sre > > a = array.array("c", "abcde") > m = sre.search("bcd", a) > print m.group(0) a1 = m.group(0) a1[0]='z' print m.group(0) So you'd have to modify a, to modify m.group(0). To catch this case, you might want to do def copy_match(m): g = m.group(0) if copy(g) is not g: raise KeyError # will be re-raised as copy.Error return g That will restore backwards compatibility with pre, which is what the submitter of the bug requested. Regards, Martin
RetroSearch is an open source project built by @garambo | Open a GitHub Issue
Search and Browse the WWW like it's 1997 | Search results from DuckDuckGo
HTML:
3.2
| Encoding:
UTF-8
| Version:
0.7.4