Feed Sign in with OpenID OpenID

Simon Willison’s Weblog

Python gems of my own (via) Did you know you can pass 128 as a flag to Python’s re.compile() function to spit out a parse tree? I didn’t. re.compile(“pattern”, 128)

Tagged , ,

2 comments

  1. I went and looked this up once, and found it's not actually Python; the "re" module is a passthrough/wrapper around the SRE library, which is what implements this flag (as, IIRC, a debugging tool).

    James Bennett - 3rd November 2008 13:55 - #

  2. The 128 is also known as re.DEBUG

    David Grant - 3rd November 2008 17:41 - #

Comments are closed.
A django site