def _fail_neg(values, errmsg='negative value'):
 for x in values:
  if (x < 0):
   raise StatisticsError(errmsg)
  (yield x)

def _fail_neg ( values , errmsg = 'negative value' ) : for x in values : if ( x < 0 ) : raise StatisticsError ( errmsg ) ( yield x )
iterate over values .