def split_on_comma(tokens):
 parts = []
 this_part = []
 for token in tokens:
  if ((token.type == u'DELIM') and (token.value == u',')):
   parts.append(this_part)
   this_part = []
  else:
   this_part.append(token)
 parts.append(this_part)
 return parts

def split_on_comma ( tokens ) : parts = [ ] this_part = [ ] for token in tokens : if ( ( token . type == u'DELIM' ) and ( token . value == u',' ) ) : parts . append ( this_part ) this_part = [ ] else : this_part . append ( token ) parts . append ( this_part ) return parts
split a list of tokens on commas .