Skip to content

Instantly share code, notes, and snippets.

@briancline
Last active August 29, 2015 14:01
Embed
What would you like to do?
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