def SortedConcatenate(sep=u','):
 def step(ctxt, ndx, value):
  if (value is not None):
   ctxt[ndx] = value
 def finalize(ctxt):
  if (len(ctxt) == 0):
   return None
  return sep.join(map(ctxt.get, sorted(ctxt.iterkeys())))
 return ({}, step, finalize)

def SortedConcatenate ( sep = u',' ) : def step ( ctxt , ndx , value ) : if ( value is not None ) : ctxt [ ndx ] = value def finalize ( ctxt ) : if ( len ( ctxt ) == 0 ) : return None return sep . join ( map ( ctxt . get , sorted ( ctxt . iterkeys ( ) ) ) ) return ( { } , step , finalize )
string concatenation aggregator for sqlite .