def texts_are_equivalent(texta, textb):
 def normalized_lines(text):
  for l in text.splitlines():
   l = l.strip()
   if l:
    (yield l)
 texta = '\n'.join(normalized_lines(texta))
 textb = '\n'.join(normalized_lines(textb))
 return (texta == textb)

def texts_are_equivalent ( texta , textb ) : def normalized_lines ( text ) : for l in text . splitlines ( ) : l = l . strip ( ) if l : ( yield l ) texta = '\n' . join ( normalized_lines ( texta ) ) textb = '\n' . join ( normalized_lines ( textb ) ) return ( texta == textb )
compares two program texts by removing all identation and blank lines first .