Skip to content

Instantly share code, notes, and snippets.

@briancline
Last active August 29, 2015 14:01
Show Gist options
  • Save briancline/e9b019c778a97027fce3 to your computer and use it in GitHub Desktop.
Save briancline/e9b019c778a97027fce3 to your computer and use it in GitHub Desktop.
Finding default mutables in Python via Sublime Text

Matches all defs, including multi-line defs:

def\s+\w+\(((?!\):).|\n)+\):

Matches all instances of ={ and =[:

=(\[|\{)

Matches all defs, including multi-line defs, containing ={ and =[:

def\s+\w+\(((?!\):)=(\[|\{)|\n)+\):

Possibly better, but absolutely horrendous:

def\s\w+\((?!\):).*(\w*=(\[|\{|\())+(?!\):).*\):
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment