def get_identifiers(source_code):
 tokens = set(re.split('[^0-9a-zA-Z_.]', source_code))
 valid = re.compile('[a-zA-Z_]')
 return [token for token in tokens if re.match(valid, token)]

def get_identifiers ( source_code ) : tokens = set ( re . split ( '[^0-9a-zA-Z_.]' , source_code ) ) valid = re . compile ( '[a-zA-Z_]' ) return [ token for token in tokens if re . match ( valid , token ) ]
split source code into python identifier-like tokens .