#NEWLINE# def longzip( a , b ) : #NEWLINE# #INDENT# 'Like `izip` but yields `None` for missing items.' #NEWLINE# aiter = iter ( a ) #NEWLINE# biter = iter ( b ) #NEWLINE# try : #NEWLINE# #INDENT# for item1 in aiter : #NEWLINE# #INDENT# ( yield ( item1 , biter . next ( ) ) ) #NEWLINE# #UNINDENT# #UNINDENT# except StopIteration : #NEWLINE# #INDENT# for item1 in aiter : #NEWLINE# #INDENT# ( yield ( item1 , None ) ) #NEWLINE# #UNINDENT# #UNINDENT# else : #NEWLINE# #INDENT# for item2 in biter : #NEWLINE# #INDENT# ( yield ( None , aiter ) )