def filter_symbols(iterator, exclude):
 exclude = set(exclude)
 for s in iterator:
  if (s not in exclude):
   (yield s)

def filter_symbols ( iterator , exclude ) : exclude = set ( exclude ) for s in iterator : if ( s not in exclude ) : ( yield s )
only yield elements from iterator that do not occur in exclude .