#NEWLINE# @ copydoc ( Coalesce ) #NEWLINE# def coalesce( a , b ) : #NEWLINE# #INDENT# a_dshape = discover ( a ) #NEWLINE# a_measure = a_dshape . measure #NEWLINE# isoption = isinstance ( a_measure , Option ) #NEWLINE# if isoption : #NEWLINE# #INDENT# a_measure = a_measure . ty #NEWLINE# #UNINDENT# isnull = isinstance ( a_measure , Null ) #NEWLINE# if isnull : #NEWLINE# #INDENT# return b #NEWLINE# #UNINDENT# if ( not isoption ) : #NEWLINE# #INDENT# return a #NEWLINE# #UNINDENT# b_dshape = discover ( b ) #NEWLINE# return Coalesce ( a , b , DataShape ( * ( maxshape ( ( a_dshape . shape , b_dshape . shape ) ) + ( promote ( isnull , b_dshape . measure ) , ) ) ) )