Peter Hansen wrote: > [EMAIL PROTECTED] wrote: > >> I get a syntax error in : >> >> py> [(min((abs(p - v), v) for v in valleys + [0] if v < p)[1], >> ... p, >> ... min((abs(p - v), v) for v in valleys if v > p)[1]) >> ... for p in peaks] > > > I think we already covered the part where you were using an older > version of Python. In this case, the missing feature is "generator > expressions" and they are inside the two min() calls. > > You might want to consider upgrading...
But if you can't, you should write this as something like: [(min([(abs(p - v), v) for v in valleys + [0] if v < p])[1], p, min([(abs(p - v), v) for v in valleys if v > p])[1]) for p in peaks] Note the extra brackets in the min calls. STeVe -- http://mail.python.org/mailman/listinfo/python-list