Skip to content

Instantly share code, notes, and snippets.

@smarnach
Created March 28, 2012 20:14
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save smarnach/2230130 to your computer and use it in GitHub Desktop.
Save smarnach/2230130 to your computer and use it in GitHub Desktop.
class MyRECache(dict):
def __missing__(self, regex):
return self.setdefault(regex, re.compile(regex))
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment