Is there a way to really pickle compiled regular expressions in python?

后端 未结 7 1681
一整个雨季
一整个雨季 2020-12-13 15:00

I have a python console application that contains 300+ regular expressions. The set of regular expressions is fixed for each release. When users run the app, the entire se

7条回答
  •  悲&欢浪女
    2020-12-13 15:27

    Just compile as you go - re module will cache the compiled re's even if you dont. Bump the re._MAXCACHE up to 400 or 500, the short jobs will only compile the re's they need, and the long jobs benefit from a big fat cache of compiled expressions - everybody's happy!

提交回复
热议问题