Override Python Library File to Circumvent Size Limitation -


i ran 100 named capture group limitation in python's regular expression named capture groups.

the hard-coded limitation in sre_compile.py:

if p.pattern.groups > 100:     raise assertionerror(         "sorry, version supports 100 named groups"         ) 

my understanding limitation performance reasons , not space limitations. in case performance issues less important capability. wonder if there reasonable way around limitation? possibly injecting replacement sre_compile.py file size check removed? of course, sounds quite risky , understand such action not recommended. however, in short term need circumvent limitation, in long term have nice work around. suggestions on best solution?

thank in advance!

no need mess python's libraries, can replace function in code:

import sre_compile  def my_compile(p, flags=0):     ...  sre_compile.compile = my_compile 

Comments